15-08-22, 08:22 PM
لكي نرسم نقاط عند الضغط بالزر الايسر للفارة على الفورم (كانك تكتب بالقلم)
استخدم الكود التالي:
استخدم الكود التالي:
كود :
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim g As Graphics = CreateGraphics()
Dim e1 As New PaintEventArgs(g, New Rectangle)
AddLinesExample(e1, e.Location)
End If
End Sub
Dim myPointArray As New List(Of Point)
Public Sub AddLinesExample(ByVal e As PaintEventArgs, epos As Point)
'Create a symetrical triangle using an array of points.
myPointArray.Add(New Point(epos))
Dim myPath As New GraphicsPath
myPath.AddLines(myPointArray.ToArray)
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
End Class


