Results 1 to 4 of 4

Thread: Dragging and Scrolling

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    4
    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

  2. #2
    Guest
    Do you mean dragging and moving items around?

    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
    It can basically move almost everything.


  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    4
    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.

  4. #4
    Guest
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width