VB6怎么简化这些代码?我控件越多,代码就越多,怎么简化??
在下新人,想问下VB6怎么简化以下代码..PrivateSub图1_Click()Me.WindowState=1EndSubPrivateSub图1_Mousedown...
在下新人,想问下VB6怎么简化以下代码..
Private Sub 图1_Click()
Me.WindowState = 1
End Sub
Private Sub 图1_Mousedown(Button As Integer, Shift As Integer, X As Single, Y As Single)
图1.Picture = LoadResPicture(101, vbResBitmap)
End Sub
Private Sub 图1_Mouseup(Button As Integer, Shift As Integer, X As Single, Y As Single)
图1.Picture = LoadPicture()
End Sub
'-------------------------
Private Sub 图2_Click()
End
End Sub
Private Sub 图2_Mousedown(Button As Integer, Shift As Integer, X As Single, Y As Single)
图2.Picture = LoadResPicture(102, vbResBitmap)
End Sub
Private Sub 图2_Mouseup(Button As Integer, Shift As Integer, X As Single, Y As Single)
图2.Picture = LoadPicture()
End Sub
'--------------------------
Private Sub 图3_Click()
'其他
End Sub
Private Sub 图3_Mousedown(Button As Integer, Shift As Integer, X As Single, Y As Single)
图3.Picture = LoadResPicture(103, vbResBitmap)
End Sub
Private Sub 图3_Mouseup(Button As Integer, Shift As Integer, X As Single, Y As Single)
图3.Picture = LoadPicture()
End Sub 展开
Private Sub 图1_Click()
Me.WindowState = 1
End Sub
Private Sub 图1_Mousedown(Button As Integer, Shift As Integer, X As Single, Y As Single)
图1.Picture = LoadResPicture(101, vbResBitmap)
End Sub
Private Sub 图1_Mouseup(Button As Integer, Shift As Integer, X As Single, Y As Single)
图1.Picture = LoadPicture()
End Sub
'-------------------------
Private Sub 图2_Click()
End
End Sub
Private Sub 图2_Mousedown(Button As Integer, Shift As Integer, X As Single, Y As Single)
图2.Picture = LoadResPicture(102, vbResBitmap)
End Sub
Private Sub 图2_Mouseup(Button As Integer, Shift As Integer, X As Single, Y As Single)
图2.Picture = LoadPicture()
End Sub
'--------------------------
Private Sub 图3_Click()
'其他
End Sub
Private Sub 图3_Mousedown(Button As Integer, Shift As Integer, X As Single, Y As Single)
图3.Picture = LoadResPicture(103, vbResBitmap)
End Sub
Private Sub 图3_Mouseup(Button As Integer, Shift As Integer, X As Single, Y As Single)
图3.Picture = LoadPicture()
End Sub 展开
展开全部
相同处理方法的控件可以形成控件数组,这样只要一个事件就可以处理所有控件
追问
要怎么做?不会给个例子或代码吧...
追答
Private Sub 图_Click(Index As Integer)
Select Case Index
Case 0
Me.WindowState = 1
Case 1
End
Case 2
'其他
End Select
End Sub
Private Sub 图_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
图1.Picture = LoadResPicture(101 + Index, vbResBitmap)
End Sub
Private Sub 图_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
图.Picture = LoadPicture()
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询