1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = Me.CreateGraphics()
If dibujalinea Then
Dim p As Pen = New Pen(Color.Aqua, 2)
ControlPaint.DrawReversibleFrame(Me.RectangleToScreen(SelectRect), Color.Black, FrameStyle.Dashed)
myLine = New Linea(0, 0, 0, 0)
If vector = 0 Then
g.DrawLine(myLine.Pincel, ps.X, ps.Y, pe.X, pe.Y)
mmx = pe.X
mmy = pe.Y
Else
g.DrawLine(myLine.Pincel, mmx, mmy, pe.X, pe.Y)
mmx = pe.X
mmy = pe.Y
vector = vector + 1
End If
vector = vector + 1
'g.DrawRectangle(p, SelectRect)
g.Dispose()
vector = vector + 1
no_vector(vector) = vector
elrio(i, 0) = ps.X
elrio(i, 1) = ps.Y
elrio2(i, 0) = pe.X
elrio2(i, 1) = pe.Y
i = i + 1
elrio(i, 0) = 0
elrio(i, 1) = 0
End If
End Sub
'**************** MOUSE UP ***********************
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
Dim g As Graphics = Me.CreateGraphics()
If dibujalinea Then
Dim p As Pen = New Pen(Color.Aqua, 2)
ControlPaint.DrawReversibleFrame(Me.RectangleToScreen(SelectRect), Color.Black, FrameStyle.Dashed)
myLine = New Linea(0, 0, 0, 0)
If vector = 0 Then
g.DrawLine(myLine.Pincel, ps.X, ps.Y, pe.X, pe.Y)
mmx = pe.X
mmy = pe.Y
Else
g.DrawLine(myLine.Pincel, mmx, mmy, pe.X, pe.Y)
mmx = pe.X
mmy = pe.Y
vector = vector + 1
End If
vector = vector + 1
'g.DrawRectangle(p, SelectRect)
g.Dispose()
vector = vector + 1
no_vector(vector) = vector
elrio(i, 0) = ps.X
elrio(i, 1) = ps.Y
elrio2(i, 0) = pe.X
elrio2(i, 1) = pe.Y
i = i + 1
elrio(i, 0) = 0
elrio(i, 1) = 0
End If
End Sub |
Partager