G
Giles
Im trying to make an application that will accept an image
that has been dragged from IE and dropped onto my form.
The Drag Drop event code is as follows:
Private Sub DragTarget_DragDrop(ByVal sender As Object,
ByVal e As DragEventArgs) Handles pb.DragDrop,
MyBase.DragDrop
If (e.Data.GetDataPresent("DeviceIndependentBitmap")) Then
Dim item As Object = CType(e.Data.GetData
("DeviceIndependentBitmap"), System.Object)
If (e.Effect = DragDropEffects.Copy Or _
e.Effect = DragDropEffects.Move) Then
Dim ms As IO.MemoryStream = CType(item,
IO.MemoryStream)
Dim bm As Bitmap = Bitmap.FromStream(ms) '***
Dim img As Image = bm
pb.Image = bm
End If
End If
End Sub
when executing nothing past the line marked '*** is
executed, and no error is produced.
Can anyone explane whats going on, and how to get this DIB
to display in a pictureBox (pb in the code above)
Thanks in advance,
Giles
that has been dragged from IE and dropped onto my form.
The Drag Drop event code is as follows:
Private Sub DragTarget_DragDrop(ByVal sender As Object,
ByVal e As DragEventArgs) Handles pb.DragDrop,
MyBase.DragDrop
If (e.Data.GetDataPresent("DeviceIndependentBitmap")) Then
Dim item As Object = CType(e.Data.GetData
("DeviceIndependentBitmap"), System.Object)
If (e.Effect = DragDropEffects.Copy Or _
e.Effect = DragDropEffects.Move) Then
Dim ms As IO.MemoryStream = CType(item,
IO.MemoryStream)
Dim bm As Bitmap = Bitmap.FromStream(ms) '***
Dim img As Image = bm
pb.Image = bm
End If
End If
End Sub
when executing nothing past the line marked '*** is
executed, and no error is produced.
Can anyone explane whats going on, and how to get this DIB
to display in a pictureBox (pb in the code above)
Thanks in advance,
Giles