Private Sub picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X > picture1.ScaleWidth Then
X = picture1.ScaleWidth
ElseIf X < 0 Then
X = 0
End If
If Y > picture1.ScaleHeight Then
Y = picture1.ScaleHeight
ElseIf Y < 0 Then
Y = 0
End If
Shape1.Visible = True
xcor0 = X: ycor0 = Y
xcor1 = 0: ycor1 = 0
xxx1 = xcor0: yyy1 = ycor0
xxx2 = xcor1: yyy2 = ycor1
Shape1.Move xcor0, ycor0, xcor1, ycor1
SetCoordinates
End Sub
Private Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
xxx2 = X - xxx1: yyy2 = Y - yyy1
xcor0 = xxx1: ycor0 = yyy1
xcor1 = xxx2: ycor1 = yyy2
If xxx2 < 0 Then
xcor0 = xxx1 + xxx2
If xcor0 < 0 Then xcor0 = 0
xcor1 = xxx1 - xcor0
End If
If yyy2 < 0 Then
ycor0 = yyy1 + yyy2
If ycor0 < 0 Then ycor0 = 0
ycor1 = yyy1 - ycor0
End If
If xcor0 + xcor1 > picture1.ScaleWidth Then xcor1 = picture1.ScaleWidth - xcor0
If ycor0 + ycor1 > picture1.ScaleHeight Then ycor1 = picture1.ScaleHeight - ycor0
Shape1.Move xcor0, ycor0, xcor1, ycor1
SetCoordinates
End If
End Sub
Private Sub SetCoordinates()
xcor1 = xcor0 + xcor1
ycor1 = ycor0 + ycor1
End Sub
Private Sub Timer1_Timer()
If Shape1.Visible = False Then Exit Sub
TIM = (TIM + 1) And 15
Shape1.BorderColor = Scol(TIM)
End Sub
Dim bStartDraw As Boolean
Dim startX As Single, startY As Single
Dim EndX As Single, EndY As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
bStartDraw = True
startX = X
startY = Y
EndX = X
EndY = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bStartDraw Then
Picture1.DrawStyle = 2
'Picture1.ForeColor = RGB(226, 173, 176)
Picture1.DrawMode = 7
Picture1.Line (startX, startY)-(EndX, EndY), RGB(226, 173, 176), B
EndX = X
EndY = Y
Picture1.Line (startX, startY)-(EndX, EndY), RGB(226, 173, 176), B
Picture1.DrawMode = 13
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
bStartDraw = False
End Sub