Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Drag label position on userform at runtime - jerky movement
I want to be able to drag a label (or other suitable control to act
like a box) on a userform at runtime. I have written the following to do this but have these problems: 1) the movement is quite jerky - at times the label can even jump backwards although I am only moving the mouse fowards 2) the mouse gets ahead of the label Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) Static sngXOld As Single Dim sngDelta As Single If m_blnMouseIsDown Then sngDelta = (X - sngXOld) Me.Label1.Left = Me.Label1.Left + sngDelta Me.Label2.Left = Me.Label2.Left + sngDelta DoEvents sngXOld = X End If End Sub I can improve things a little bit by only moving the label once the mouse is moved a certain minimum distance, ie. If Abs(sngDelta) 5, but it's still not perfect and the mouse still gets ahead of the label. Can anyone suggest an alternative approach - or have I simply overlooked something here? Thanks a lot, Andrew |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Default Data Label Position | Charts and Charting in Excel | |||
Outside Label Position not listed | Charts and Charting in Excel | |||
Change label border color at runtime | Excel Programming | |||
Add a label at runtime | Excel Programming | |||
Data Label Object Position not working | Excel Programming |