通过移动鼠标移动控件,鼠标移动后,控件消失了
在PictureBox内,放置了一个command按钮,现在想实现通过移动鼠标,将该按钮移动到任意的位置。参考下面的代码程序代码:
Dim x1, y1 As Double Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) x1 = X y1 = Y End Sub Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Command1.Left = Command1.Left + (X - x1) Command1.Top = Command1.Top + (Y - y1) End If End Sub
但是,现在添加完后,移动command控件后,控件消失了,不知道怎么解决了,求助大家!