colossus1958
Member
- Joined
- Sep 7, 2008
- Messages
- 10
- Programming Experience
- Beginner
I previously posted to this forum asking about making the various drag/drop subs work for multiple PictureBoxes (40+). I implemented the responses to that posting and voila! Everything works... except:
1) The images are not actually dropping. All subs seem to be operating and my variable watches appear to be yielding the right values at the right times, but no drop.
2) I need to know how to get rid of the original picturebox image without voiding the destination image as well.
Below is a sample version of my code. If we can't determine what's wrong via the sample, I'll attach the full version. This is so close to working properly (I think!).
1) The images are not actually dropping. All subs seem to be operating and my variable watches appear to be yielding the right values at the right times, but no drop.
2) I need to know how to get rid of the original picturebox image without voiding the destination image as well.
Below is a sample version of my code. If we can't determine what's wrong via the sample, I'll attach the full version. This is so close to working properly (I think!).
VB.NET:
Public Class Form1
Public m_MouseIsDown As Boolean
Private Sub Mouse_Down(ByVal sender As PictureBox, ByVal e As MouseEventArgs) _
Handles PB1.MouseDown, PB2.MouseDown, PB3.MouseDown, _
PB4.MouseDown
If Not sender.Image Is Nothing Then
m_MouseIsDown = True
End If
End Sub
Private Sub Mouse_Move(ByVal sender As PictureBox, ByVal e As MouseEventArgs) _
Handles PB1.MouseMove, PB2.MouseMove, PB3.MouseMove, _
PB4.MouseMove
If m_MouseIsDown Then
sender.DoDragDrop(sender.Image, DragDropEffects.Move)
Else
sender.DoDragDrop(sender.Image, DragDropEffects.None)
End If
End Sub
Public PicImage As PictureBox
Public Sub Give_Feedback(ByVal sender As PictureBox, ByVal e As _
System.Windows.Forms.GiveFeedbackEventArgs) _
Handles PB1.GiveFeedback, PB2.GiveFeedback, _
PB3.GiveFeedback, PB4.GiveFeedback
e.UseDefaultCursors = False
Dim bmp As Bitmap = New Bitmap(sender.Image)
Windows.Forms.Cursor.Current = New Cursor _
(bmp.GetHicon)
End Sub
Private Sub Drag_Enter(ByVal sender As PictureBox, ByVal e As DragEventArgs) _
Handles PB5.DragEnter, PB6.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Move
Else
e.Effect = DragDropEffects.Copy
End If
End Sub
Private Sub Drag_Drop(ByVal sender As PictureBox, ByVal e As DragEventArgs) _
Handles PB5.DragDrop, PB6.DragDrop
sender.Image = e.Data.GetData(DataFormats.Bitmap)
End Sub
Private Sub CardLogic(ByVal sender As Object, ByVal e As DragEventArgs)
End Sub
End Class