Move controls around form at runtime?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul

    Move controls around form at runtime?

    Hi,

    I am looking to create an eLearning resource using VB2008. I have a
    form with a background picture of a cross section of a strand of hair
    magnified x1000. The around the edge of the hair strand there are
    empty boxes. The boxes are part of the background image (jpg).

    The user drags a command button, labelled, for example, 'Hair
    Follicle' over to an empty box and drops 'within'. This process is
    repeated for the remaining command buttons / labels. So in essence,
    the user is simple moving command buttons to other locations on the
    form but the background image gives the illusion that they are
    dropping the labels in empty boxes.

    I have managed to use the following code to move the command buttons
    around the form and I can position them over the empty boxes
    sucessfully.

    Private Sub Button1_MouseDo wn(ByVal sender As Object, ByVal e As
    System.Windows. Forms.MouseEven tArgs) Handles Button1.MouseMo ve
    If e.Button = System.Windows. Forms.MouseButt ons.Left Then
    Button1.Capture = False
    Dim msg As Message = Message.Create( Button1.Handle,
    WM_NCLBUTTONDOW N, _
    New IntPtr(HTCAPTIO N), IntPtr.Zero)
    Me.DefWndProc(m sg)
    End If
    End Sub

    I would like the command buttons to snap into place when they are
    dropped. Is this possible? I would also like to test if the command
    buttons are dropped onto the correct labels and feedback given to the
    user in the form of a dialog box.

    Any ideas? Any help is much appreciated.

    Thanks,
    Paul
Working...