VB.net画图,如何一直保持图形显示? 35
我使用了Tabcontrol控件,在tabpage1中的picturebox1中用pen画了个圆和一条直线,运行时点了tabpage2再点tabpage1时画的图形不见了...
我使用了Tabcontrol控件,在tabpage1中的picturebox1中用pen画了个圆和一条直线,运行时点了tabpage2再点tabpage1时画的图形不见了,这是为什么那?怎么样才能保持这个圆一直处于显示状态?
代码如下:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Click
'画圆
g = PictureBox1.CreateGraphics
pen1 = New Drawing.Pen(Color.Red, 1)
PictureBox1.Refresh()
g.Graphics.DrawEllipse(pen1, 0, 0, 100, 100)
'画直线
pen1 = New Drawing.Pen(Color.Green, 1)
g.Graphics.DrawLine(pen1, P_X(1), P_Y(1), P_X(1) + 60, P_Y(1))
End Sub 展开
代码如下:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Click
'画圆
g = PictureBox1.CreateGraphics
pen1 = New Drawing.Pen(Color.Red, 1)
PictureBox1.Refresh()
g.Graphics.DrawEllipse(pen1, 0, 0, 100, 100)
'画直线
pen1 = New Drawing.Pen(Color.Green, 1)
g.Graphics.DrawLine(pen1, P_X(1), P_Y(1), P_X(1) + 60, P_Y(1))
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询