为什么用下面的代码绘出来的图一闪就没有了
Private Sub Button1_Click(ByVal sender As Systemobject, ByVal e As System.EventArgs)Hardles Button1.Click
DrawALine(PageToShow,Color.Red,50, 50,5,100)
End Sub
”以下建立绘图函数
Public sub DrawALine(ByVal WhereToraw as Picture,ByVal Draw_Color As Color,
ByVal StartPoint_X As Integer,ByVal StartPoint Y As Integer, ByVal Line_Width As Integer, ByVal Line_Height As Integer)
Dim Pic As New PictureBox
With Pic
.Name ="Pic"
.Size = New Size(Line_Width+ 6, Line_Height + 6)
.SizeMode = PictureBoxSizemode.StretchImage
.Parent = WhereToDraw
.Location= New PointStartPoint_x-3 StartPoint_Y-3)
End With
Dim g As Graphics=Pic.CreateGraphics
Dim Draw_Pen As New Pen(Draw_color, Line Width)
g.DrawLine (Draw_Pen, 3 3,3+ Line_Width, 3 + Line_Height)
Ernd Sub