跪求!!跪求!!VB picturebox Graphics.FromImage 对象正在使用的问题
两个Picturebox 对应两个副线程,只运行一个picturebox ,或者两个一起用的话,偶尔会出现Graphics.FromImage,正在使用的错误,System.InvalidOperationException: 对象当前正在其他地方使用。
在 System.Drawing.Graphics.FromImage(Image image)
Private Sub BgDrawPicturebox2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BgDrawPicturebox2.DoWork
PictureBox2.Refresh()
Dim g3 As Graphics
Dim bmp3 As Bitmap
bmp3 = New Bitmap(470, 240)
PictureBox2.Image = bmp3
g3 = Graphics.FromImage(PictureBox2.Image)
DrawOrdinate2(g3, 1, 5, 35, 220, 435, 20)
DrawaxisValue2(g3)
Drawtarget2(1, g3)
g3.Dispose()
System.Threading.Thread.Sleep(300)
End Sub