求助!!这个vb程序错在哪里??

来源:百度知道 编辑:UC知道 时间:2024/06/08 00:08:35
Dim x0 As Integer
Dim y0 As Integer
Dim style As Integer

Private Sub Optcircle_Click()
If Optcircle.Value = True Then style = 3
End Sub

Private Sub Optcurve_Click()
If Optcurve.Value = True Then style = 2
End Sub

Private Sub Optellispe_Click()
If Optellispe.Value = True Then style = 4

End Sub

Private Sub Optline_Click()
If Optline.Value = True Then style = 1
End Sub

Private Sub Optrectangle_Click()
If Optrectangle.Value = True Then style = 5
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
x0 = X
y0 = Y
Picture1.MousePointer = vbCrosshair
Select Case style
Case 3: Shape1.Shape = 3
Case 4: Shape1.Shape = 2
Case 5: Shape1.Shape = 0
End Select

End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

1. Line1,Shape1这2个控件,必须在Picture1这个框架上添加!!!
2. Picture1的autodraw=true

你需要用鼠标在Picture里画图,就像画图板一样,这段代码不是演示成品图的。

把AutoRedraw=True就可以了.