코드를 복사하고 붙여 넣는 것이 가장 좋을 것이라고 생각합니다 (매우 간단합니다).여러 스레드 (VB.NET)와 함께 GDI +를 사용하는 경우의 문제
Private Sub Main() Handles MyBase.Shown
timer.Interval = 10
timer.Enabled = True
End Sub
Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
e.Graphics.DrawImage(image, 0, 0)
End Sub
Private Sub tick() Handles timer.Elapsed
Using g = Graphics.FromImage(image)
g.Clear(Color.Transparent)
g.DrawLine(Pens.Red, 0 + i, 0 + i, Me.Width - i, Me.Height - i)
End Using
Me.Invalidate()
End Sub
"개체가 현재 다른 곳에서 사용되고 있습니다."예외는 틱 이벤트 중에 발생합니다. 누군가가 왜 이런 일이 일어나고 어떻게 해결할 수 있는지 말해 줄 수 있습니까? 감사.
어떤 종류의 타이머가 '타이머'입니까? – Thomas