-1

I am trying to write a simple program for studying English Language. Although such kind of software is already available, I need to create a new one so I can add my own material to practice more.

I am using VB.NET (VS2012), and until now i tried with label control. The data from my database is like this:


Context sample text {B1} and {B2} and so on.

Which in my data, {B1} and {B2} indicate the blanks areas.

How can I achieve it with capability of retrieving that the user dragged which one of the options to which position?

I have added a GIF of what i mean in following.

Thanks in advance. Like this, please click to see

  • The first thing to do would be to learn how drag and drop works in Windows Forms. It's not for us to teach you a subject from scratch. You need to do your own research, make your best attempt at an implementation and then, if that doesn't work, post here with a description of what you have done and exactly where you are stuck. – jmcilhinney Jan 04 '19 at 13:36
  • Some of my previous answers which may be of interest to you: [Enable other event while dragging an object](https://stackoverflow.com/a/44400749/3740093), and: [Snap PictureBox to Buttons after Drag and Drop](https://stackoverflow.com/a/41801467/3740093). – Visual Vincent Jan 04 '19 at 15:52

1 Answers1

-1

the code for move All controls types is here:

If e.Button = Windows.Forms.MouseButtons.Left Then
    newpoint = Control.MousePosition
    newpoint.X -= x
    newpoint.Y -= y
    LABEL.Location = newpoint
    Application.DoEvents()
End If

Where x is an Integer, y is an integer and newpoint is a New Point.

This code goes in LABEL.MouseMove event.

But you have to assign a value to x and y, and here is the code:

Private Sub PANEL_MouseDown(sender As Object, e As MouseEventArgs) Handles PANEL.MouseDown
    x = Control.MousePosition.X - Me.Location.X
    y = Control.MousePosition.Y - Me.Location.Y
End Sub

I know this code doesn't answer completely to your question, but it's a help.