怎样才能在form中用鼠标自由的改变控件大小和移动控件位置?谢谢
这是个老问题,但是没找到例子,谢谢了~
[解决办法]
移动控件位置的方法如下,自由用黍标改变控件大小方法未找到:
SINA网友bryant1976给出的解决方法是:设置picture1的dragmode为0(手动),并定义两个变量用于开始拖动时的鼠标位置,代码如下:
Dim cx as Long, cy as Long
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - cX, Y - cY
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Drag 1
cX = X: cY = Y
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Drag 2
End Sub
之所以将Picture1的DragMode改为手动,是因为在自动模式下是不会触发Picture1的MouseDown事件的,当然也就无法记录原始的鼠标位置了。