我早年写的代码,不太中看,您将就点
移得好像很准。Private Sub pi_DragDrop(Source As Control, x As Single, y As Single)
pi.Move x - zi, y - zj
End SubPrivate Sub pi_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
zi = x - pi.Left
zj = y - pi.Top
End If
End Sub
移得好像很准。Private Sub pi_DragDrop(Source As Control, x As Single, y As Single)
pi.Move x - zi, y - zj
End SubPrivate Sub pi_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
zi = x - pi.Left
zj = y - pi.Top
End If
End Sub
解决方案 »
- SQL查询排行的问题
- ====有关API函数GetFileTime的疑问,为什么文件内容已经改变,但是返回的LastWrite时间确相同?====
- 通过VB程序在WORD中添加一个按钮
- 当用户在DataGrid中点击某一行,怎么样才能让用户知道已经选了这行了。各位给点见意。
- WINDOWS消息经常使用十六进制的常数那里有解释啊?最好是帮助一样的,谢谢
- visio是干什么用的,从那里可以找到
- 问几个菜鸟问题关于数组的。请大家帮忙!
- 文本框绑定数据库字段的带来的数据类型冲突问题,急问
- VB文件操作
- 关于Getsetting函数访问注册表的问题(急阿)
- 急!!!!!!!!!在线等待
- 需要整套ERP源代码的VB程序员注意啦!
dragx和dragy是label内的X,Y,值太小,反应不出来了
If TypeOf Source Is CommandButton Then
Source.Move X, Y
End If
End SubPrivate Sub Form_Load()
Command1.DragMode = 1
End Sub
Dim dragX As Single, dragY As Single
Private Sub ctrResistance1_mousedown()
ctrResistance1.Drag 1
dragX = X
dragY = Y
End SubPrivate Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move (X - dragX), (Y - dragY)
End SubctrResistance控件的代码如下:Option Explicit
Public Event mousedown()
Private Sub UserControl_Initialize()
'调整shape1的大小和用户控件大小一样
Shape1.Move 0, 0, ScaleWidth, ScaleHeight
End SubPrivate Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent mousedown
End Sub