程序中线的位置是(1080,1800)-(5040,1800),左边的小球是imgball,现在要求imgball只能在左右方向拖动,并且不超过线的范围,线的最左边的值是0,最右边是100,值显示在txtvalue中请求高手帮助~在线等~
解决方案 »
- 子窗体调用父窗体一个按钮CLICK
- 实时错误2147217864(80040e38),无法为更新定位行。一些值可能已在最后一次读取后已更改
- vb执行查询时,cpu会100%,如何把cpu降下来?我用了doevents还是不行
- listview控件的使用问题?急!!
- 菜鸟问题!!I/O是什么??
- 我想在vb中建一个activex dll,里面有一个窗体,如何在主程序中显示出窗体呢
- WORD问题
- 怎么样编程修改机器的ip地址和 计算机名?
- 请问在vb中如何使一个access数据库实现多用户访问??请高手指点!!!!!!
- 如果在VB中改变鼠标图标成为一只手,与IE中的超链接一样的手?
- vb多线程问题
- 帮忙解释下面程序
区域长度范围左右两边都减去imgball.width/2
以imgball的中心为坐标点取比例
Option ExplicitPrivate m_OnDrag As BooleanPrivate m_Value As LongFriend Property Get Value() As Long
Value = m_Value
End Property
Friend Property Let Value(ByVal RHS As Long)
Dim X As Long
If RHS < 0 Then
m_Value = 0
ElseIf RHS > 100 Then
m_Value = 100
Else
m_Value = RHS
End If
Text1.Text = CStr(m_Value)
X = 1080 + 39.6 * m_Value
imgball.Move X - imgball.Width \ 2, 1800 - imgball.Height \ 2
End PropertyFriend Sub DragTo(ByVal X As Long)
Me.Value = (X - 1080) / 39.6
End SubPrivate Sub Form_Load()
Me.Value = 0
End SubPrivate Sub imgball_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
m_OnDrag = True
Me.DragTo imgball.Left + X
End If
End SubPrivate Sub imgball_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If m_OnDrag Then
Me.DragTo imgball.Left + X
End If
End SubPrivate Sub imgball_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If m_OnDrag And (Button = vbLeftButton) Then
m_OnDrag = False
End If
End SubPrivate Sub imgLine_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Me.DragTo imgLine.Left + X
End If
End Sub
2)imgLine_MouseDown 中不是调用了 DragTo,移动过去了啊!如果要不放手继续拖动,在这里也打开 m_OnDrag 开关。