各位帮帮忙!!!
添加4 个 image 控件
前3个设为控件数组
第四个作为交换暂存用(并设为不可见)
再用DragDrop
代码如下:
Private Sub Form_Load()
Image1(0).DragMode = 1
Image1(1).DragMode = 1
Image1(2).DragMode = 1
Image2.Visible = False
End Sub
Private Sub Image1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Dim sIndex As Integer
sIndex = Source.Index
Image2.Picture = Image1(Index).Picture
Image1(Index).Picture = Source.Picture
Image1(sIndex).Picture = Image2.Picture
End Sub
Private Sub Image1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
‘Dim sIndex As Integer
sIndex = Source.Index
Image2.Picture = Image1(Index).Picture
Image1(Index).Picture = Source.Picture
Source.Picture = Image2.Picture
End Sub
这样就好 干嘛还设个sIndex变量!