private bool choose=false;private void button2_Click(object sender, System.EventArgs e)
{
this.choose=true;
this.pictureBox1.Refresh();
}private void pictureBox1_Paint(object sender,PaintEventArgs e)
{
if(choose)
{
Pen p=new Pen(Color.Red);
g.DrawLine(p,10,10,100,10);
}
}为什么每次只点击一下button无法触发picturebox的重画,而改为
private void button2_Click(object sender, System.EventArgs e)
{
this.choose=true;
this.pictureBox1.Refresh();
this.pictureBox1.Refresh();
}
就可以了,请高手指点。
解决方案 »
- 怎么在软件里面设置HTTP代理和浏览器代理
- 执行sqlcom.Parameters.Add("@Depot",SqlDbType.VarChar,30).Value = P_Depot;报错!急!
- 初学者问题之五:关于C#中的using
- webbrowser的documentcompleted事件不执行
- dataGridView添加ComboBox位置怎么修改?
- wpf项目中窗口调用close()不能完全退出程序,还停留在debug状态
- 我这个webservice是不是调用的有问题
- 触摸屏开发疑问
- 简单问题:请问C#里怎样退出当前函数啊?
- 在.net中组件和控件有什么不同?
- 递加跟IF还有等等,不懂说了,就是问题~~
- 如何安装visual stdio.net软件?
e.Graphics.DrawLine(p, 10, 10, 100, 10);
不是
g.DrawLine(p,10,10,100,10);