我只是新手,我试图做一个简单的程序,在Visual Basic 6的代码几乎等同于教科书。 它被认为是一种画图程序的。 出人意料的是,它不能在这个问题的标题给出的错误编译。 这是代码:
Option Explicit
Dim Col As Long
Private Sub Form_Load()
AutoRedraw = True
BackColor = vbWhite
Col = vbBlack
DrawWidth = 3
End Sub
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Form1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
Private Sub Command2_Click()
CommonDialog1.ShowSave
SavePicture Image, CommonDialog1.FileName
End Sub
Private Sub Command3_Click()
CommonDialog1.ShowColor
Col = CommonDialog1.Color
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
PSet (X, Y), Col
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Line1"
DrawWidth = 3
Case "Line2"
DrawWidth = 20
End Select
End Sub
应用程序崩溃以下行:
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
出现错误:
过程声明不匹配事件的描述或过程具有相同名称