How to OLE drag-n-drop a frame on a form?

Can I use the ole properties to enable drag and drop of a frame to a differnet position on a form? Will the frames controls travel nicely with it?
LVL 5
mccainz2Asked:
Who is Participating?
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You don't need OLE for that...

Option Explicit

Private startX As Single
Private startY As Single

Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        startX = X
        startY = Y
    End If
End Sub

Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        Frame1.Left = Frame1.Left + (X - startX)
        Frame1.Top = Frame1.Top + (Y - startY)
    End If
End Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.