比较急的问题,关于picturebox上图形重画的。
lxcy 2006-09-28 11:23:22 在窗体上放一个button,一个picturebox
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim Ipen As Pen = New Pen(Color.Red, 3)
Dim Igraph As Graphics = PictureBox1.CreateGraphics
Igraph.DrawLine(Ipen, 12, 13, 45, 167)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Ipen As Pen = New Pen(Color.Red, 3)
Dim Igraph As Graphics = PictureBox1.CreateGraphics
Igraph.DrawLine(Ipen, 12, 13, 45, 167)
End Sub
这样窗体在最小化后,再激活,根本无图形。
当picturebox控件被其它窗体遮掩住时,遮掩它的窗体移动一下,依然没有图形,要移动两次,才会重新画出来。
奇怪,好像paint事件的代码执行无效。
我用的是vb2005,请帮忙看一下,谢谢!