怎么用button click事件触发Picturebox的绘制?
我在private void button1_Click(object sender, EventArgs e)
{
]
里写的第一句
Graphics g = e.Graphics;
系统就提示我System.EventArgs里不包含Graphics定义
要怎么解决? --------------------编程问答-------------------- 参见
http://social.msdn.microsoft.com/Forums/zh-CN/visualcshartzhchs/thread/9751791b-fc8e-4f61-91e4-a6e99689a605/ --------------------编程问答--------------------
能再说的具体一点吗 --------------------编程问答-------------------- 你可以给个bool isDraw;
属性赋值给Picturebox
(重写Picturebox控件)
当这个值为true的时候重绘Invalidate(); --------------------编程问答--------------------
饿……有些不大明白,能再仔细讲解下吗 --------------------编程问答-------------------- 把picturebox定义出来
在button事件里面写
Graphic g = picurebox.CreateGraphic(); --------------------编程问答--------------------
Graphics g = e.Graphics;//e.Graphics是针对paint事件的
void pnl_Paint(object sender, PaintEventArgs e)
{
Graphics gLine = e.Graphics;
gLine.DrawLine(Pens.LightGray, new Point(20, 2), new Point(960, 2));
}
补充:.NET技术 , C#