public void DrawMe() //这里该写什么???
{
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create location and size of rectangle.
int x = 0;
int y = 0;
int width = 200;
int height = 200;
// Fill rectangle to screen.
e.Graphics.FillRectangle(blueBrush, x, y, width, height);//这里会提示错误,说Graphics引用不到,为什么啊?
System.Diagnostics.Trace.TraceInformation("Lei's DrawMe");
}
有什么要注意的?为什么引用了using System.Drawing; 命名空间还是提示错误?
在其他类里还有一个调用这个方法的地方,代码如下:
private void panel1_Paint(object sender, PaintEventArgs e)
{
controller.DrawEntity();//这个括号里应该写什么呢?编译时这里会提示错误?
}
那位高手能指点一下呢!谢了?
在定义DrawMe() 方法时,有个参数:(Graphics e)但是加上了又会有下面的错误:错误 4 “System.Drawing.Graphics”不包含“Graphics”的定义,并且找不到可接受类型为“System.Drawing.Graphics”的第一个参数的扩展方法“Graphics”(是否缺少 using 指令或程序集引用?)
这是什么原因啊?
在前面有掉用这个方法的地方,里面需要有参数值,但是我不知道该怎么写!谢了
这个是要在哪里画图?这个代码不太全啊,看不到是怎么调用的。