I've seen a lot of samples here regarding the scrolling of items that are in a fixed position relative to each other. I was wondering if anyone has any code samples for implementing a combination of dragging items and scrolling.
Thanks
Printable View
I've seen a lot of samples here regarding the scrolling of items that are in a fixed position relative to each other. I was wondering if anyone has any code samples for implementing a combination of dragging items and scrolling.
Thanks
Do you mean dragging and moving items around?
It can basically move almost everything.Code:Dim oldX As Long, oldY As Long, isMoving As Boolean
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
oldX = X
oldY = Y
isMoving = True
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If isMoving Then
Image1.Top = Image1.Top - (oldY - Y)
Image1.Left = Image1.Left - (oldX - X)
End If
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
isMoving = False
End Sub
Thanks Matthew.... I understand how to move the items themselves but its the interaction with the scrolbar that I'm having difficulty with. For example, when I drag an item to the bottom of the window I basically want the virtual to "grow" and be reflected by the scrollbar. Also need some help in correlating how to display the contents of the window based on the value of the scrollbar.
Here is the thread to an example of how to make a scrollable form. I am sure you will be able to make the scrollbar visible and not visible when you detect an object that is not on in your form's width/height areas.