Results 1 to 6 of 6

Thread: Dragging And Dropping Frames

  1. #1

    Thread Starter
    Lively Member lavarock09's Avatar
    Join Date
    Jun 2005
    Posts
    124

    Dragging And Dropping Frames

    I Have This Code To Drag My Frame

    VB Code:
    1. Private Sub Frame4_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     Dim OffsetX As Integer
    3. Dim OffsetY As Integer
    4.     OffsetX = x
    5.     OffsetY = y
    6.     Frame4.Drag vbBeginDrag
    7. End Sub

    but that doesnt drop it

    how do i drop the frame

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Dragging And Dropping Frames

    You have to code the "drop" part as well.
    See attachments.
    Attached Files Attached Files

  3. #3
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Dragging And Dropping Frames

    Would modifying the method I suggested for a command button (here) work for you?

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Dragging And Dropping Frames

    My standard code for moving controls:
    VB Code:
    1. Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. Static ssngX As Single, ssngY As Single
    3.     If (Button = vbLeftButton) Then
    4.         Frame1.Move Frame1.Left + X - ssngX, Frame1.Top + Y - ssngY
    5.       Else
    6.         ssngX = X
    7.         ssngY = Y
    8.     End If
    9. End Sub

  5. #5

    Thread Starter
    Lively Member lavarock09's Avatar
    Join Date
    Jun 2005
    Posts
    124

    Re: Dragging And Dropping Frames

    Quote Originally Posted by penagate
    My standard code for moving controls:
    VB Code:
    1. Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. Static ssngX As Single, ssngY As Single
    3.     If (Button = vbLeftButton) Then
    4.         Frame1.Move Frame1.Left + X - ssngX, Frame1.Top + Y - ssngY
    5.       Else
    6.         ssngX = X
    7.         ssngY = Y
    8.     End If
    9. End Sub
    the top line of this code

    VB Code:
    1. Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    gets the error

    Compile Error: Procedure Declaration Does Not Match Description Of Event Or Procedure having the same name

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Dragging And Dropping Frames

    It's exactly the same as the header of your code

    Just check you replaced Frame1 with the name of your Frame control.

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