当前位置:编程学习 > C#/ASP.NET >>

怎么用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/ --------------------编程问答--------------------
引用 1 楼  的回复:
参见
http://social.msdn.microsoft.com/Forums/zh-CN/visualcshartzhchs/thread/9751791b-fc8e-4f61-91e4-a6e99689a605/

能再说的具体一点吗 --------------------编程问答-------------------- 你可以给个bool isDraw;
属性赋值给Picturebox
(重写Picturebox控件)
当这个值为true的时候重绘Invalidate(); --------------------编程问答--------------------
引用 3 楼  的回复:
你可以给个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#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,