1个回答
展开全部
写了个实例,用到 Image1,Image2,Image3 3个图片控件和一个Shape1模拟拖动框并判断坐标进行互换
工程里面含有图片所以压缩包会大点,代码如下
Dim si As Integer
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
si = X
Shape1.Visible = True
Shape1.Left = Image1.Left - 20
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Left = Image1.Left + X - si
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Visible = False
If Shape1.Left + Shape1.Width >= Image2.Left Then
Image3.Picture = Image1.Picture
Image1.Picture = Image2.Picture
Image2.Picture = Image3.Picture
End If
End Sub
Private Sub Image2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
si = X
Shape1.Visible = True
Shape1.Left = Image2.Left - 20
End Sub
Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Left = Image2.Left + X - si
End Sub
Private Sub Image2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Visible = False
If Shape1.Left <= Image1.Left + Image1.Width Then
Image3.Picture = Image1.Picture
Image1.Picture = Image2.Picture
Image2.Picture = Image3.Picture
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询