ببینید، من برای رسم خطوط و دایره از این کد استفاده کردم.
کد:
Private Sub PicEdit_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PicEdit.Paint
If Manualy = False And Automatic = True Then
With e.Graphics
Using redBrush As New SolidBrush(Color.PaleGreen)
Using TPen As New System.Drawing.Pen(Color.PaleGreen, 1)
Dim rect As New Rectangle(x1, y1, xyWidth, xyHeight)
TPen.Width = My.Computer.Registry.GetValue(StrRegistry, "Size", Nothing)
.DrawEllipse(TPen, x1, y1, xyWidth, xyHeight)
.FillEllipse(redBrush, rect)
'.DrawLine(TPen, x2, y2, x3, y3)
End Using
End Using
End With
strResult = "Auto"
ElseIf Manualy = True And Automatic = False Then
With e.Graphics
Using redBrush As New SolidBrush(Color.Red)
Dim rect As New Rectangle(x1, y1, xyWidth, xyHeight)
.DrawEllipse(Pens.Red, x1, y1, xyWidth, xyHeight)
.FillEllipse(redBrush, rect)
End Using
End With
strResult = "Manual"
End If
End Sub
و برای اینکه این کد رو اجرا کنم از این کد استفاده کردم
کد:
Addhander PicEdit.Paint, AddressOf PicEdit_Paint
اما این کد عمل نمکنه و خطوط و دایره رو رسم نمیکنه. البته اگه توی button بذارم و یک مقدار بهش بدم عمل میکنه. اما توی برنامه ای که من نوشتم حداقل 100 دایره باید نمایش بده و بین این دایره ها خطوط بکشه.
حالا من نمیدونم مشکل از کجاست
من کد دومی رو توی یه حلقه for گذاشتم که هر نقطه ای که موقعیتش بدست میاد و نمایش بده، اما این کد اجرا نمیشه و به مرحله بعد میره و یه موقعیت دیگه رو بدست میاره