Graphics g = pictureBox1 .CreateGraphics; g.DrawRectangle(p1, 5, 5, 5, 5);
} Error 1 Cannot convert method group 'CreateGraphics' to non-delegate type 'System.Drawing.Graphics'. Did you intend to invoke the method? H:\mouse\mouse\Form1.cs 28 26 mouse 请教高手在C# mobile中如何改正?
在图片画图请用 Graphic g=picturebox.CreateGraphic()
g.Draw(...)函数
{
Bitmap map = new Bitmap("\\Storage Card\\xue.JPG");
pictureBox1.Image = map;
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
Pen p1;
p1 = new Pen(Color.Red,1);
Graphics g = pictureBox1 .CreateGraphics;
g.DrawRectangle(p1, 5, 5, 5, 5);
}
Error 1 Cannot convert method group 'CreateGraphics' to non-delegate type 'System.Drawing.Graphics'. Did you intend to invoke the method? H:\mouse\mouse\Form1.cs 28 26 mouse
请教高手在C# mobile中如何改正?
CreateGraphics是一个方法,不是一个属性
所以报错
不能将方法组‘CreateGraphics’转换成非委托类型
CreateGraphics变成CreateGraphics()应该没问题了
private PictureBox picB;
private int d_x1=picA.Location.X;
private int d_y1=picA.Location.Y;
private int d_x2=picB.Location.X;
private int d_y1=picB.Location.Y;///获取鼠标按下时picA和picB的坐标点
private picA_MouseDown()
{
d_x1=picA.Location.X;
d_y1=picA.Location.Y;
d_x2=picB.Location.X;
d_y1=picB.Location.Y;
}
///获取鼠标释放时picA和picB的坐标点
private picA_MouseUp()
{
......................//略.........
再获取次位置
两次获得的值计算出来就可以了
}