|
-
Jun 16th, 2019, 03:03 AM
#1
Thread Starter
Lively Member
[RESOLVED] Cannot move dropped textbox
Dear Gurus,
I have an application where I'm actually moving, with drag and drop, some texboxes in a picturebox.
Now, once dropped, each textbox is becoming locked, in the sense that I cannot further adjust location and move it, while I would like to enable it.
Do you know how can I achieve it? Is there any property in the dropped textbox that I'm missing?
I report here below the implemented code.
Thanks for your support,
A.
Code:
Private Sub Form11_Load(sender As Object, e As EventArgs) Handles Me.Load
PictureBox3.AllowDrop = True
End Sub
Private Sub PictureBox3_DragDrop(sender As Object, e As DragEventArgs) Handles PictureBox3.DragDrop
Dim tb As TextBox = DirectCast(e.Data.GetData(GetType(TextBox)), TextBox)
Dim t1 As New TextBox
t1.Location = New Point(MyPanel2.PointToClient(Control.MousePosition).X - Me.PictureBox3.Left,
MyPanel2.PointToClient(Control.MousePosition).Y - Me.PictureBox3.Top)
t1.Text = tb.Text
t1.Font = tb.Font
t1.TextAlign = HorizontalAlignment.Center
t1.ForeColor = tb.ForeColor
t1.BackColor = tb.BackColor
PictureBox3.Controls.Add(t1)
End Sub
Private Sub PictureBox3_DragEnter(sender As Object, e As DragEventArgs) Handles PictureBox3.DragEnter
If e.Data.GetDataPresent(GetType(TextBox)) And CBool(e.KeyState And 8) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub TextBox9_MouseDown(sender As Object, e As MouseEventArgs) Handles TextBox9.MouseDown
TextBox9.DoDragDrop(TextBox9, DragDropEffects.Copy)
End Sub
Private Sub TextBox10_MouseDown(sender As Object, e As MouseEventArgs) Handles TextBox10.MouseDown
TextBox10.DoDragDrop(TextBox10, DragDropEffects.Copy)
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|