如题.....
private sub form1_load()
picture.line=?
好象有些东西不懂..
希望有资料的大大能给予一些简单的VB语句..
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
Picture1.Cls
End If
Picture1.DrawStyle = 4
x1 = X: y1 = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Picture1.Line (x1, y1)-(x2, y2), RGB(255, 0, 0), B
Picture1.Cls
x2 = X: y2 = Y
Picture1.Line (x1, y1)-(x2, y2), RGB(255, 0, 0), B
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
If you <> 1 Then
x11 = x1: y11 = y1
x22 = X: y22 = Y
Picture1.Line (x11, y11)-(x22, y22), RGB(255, 255, 0), B
you = 1
End If
End Sub
Dim x1, x11, x2, x22, y1, y11, y2, y22 As Double
Dim you As Integer
Private Sub Command1_Click()
Picture2.Cls
On Error GoTo a
Picture2.PaintPicture Picture1, x11, y11, x22 - x11, y22 - y11, x11, y11, x22 - x11, y22 - y11, vbSrcCopy
you = 0
Picture1.Cls
Exit Sub
a:
MsgBox "没有选图!"
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
Picture1.Cls
End If
Picture1.DrawStyle = 4
x1 = x: y1 = y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
'Picture1.Line (x1, y1)-(x2, y2), RGB(255, 0, 0), B
Picture1.Cls
x2 = x: y2 = y
Picture1.Line (x1, y1)-(x2, y2), RGB(255, 0, 0), B
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
If you <> 1 Then
x11 = x1: y11 = y1
x22 = x: y22 = y
Picture1.Line (x11, y11)-(x22, y22), RGB(255, 255, 0), B
you = 1
End If
End Sub