DIB - Memorystream

  • Thread starter Thread starter LoSTMaN
  • Start date Start date
L

LoSTMaN

Hi,

I try to make a DragDrop to a Picturebox, to drag images from IE.
But i'm stuck here :
If (e.Data.GetDataPresent("DeviceIndependentBitmap")) Then
PictureBox1.Image =
e.Data.GetData("DeviceIndependentBitmap")
End If

The problem is, that a cannot make this because
e.Data.GetData("DeviceIndependentBitmap") is a memorystream, what can i do
to make a image with this ?

I saw some example on the NET, but they were all in C#.

Thanks in advance
 
Hi Lostman,

It is very simple
dim abyt() as byte 'as the sample bytearray
Dim ms As New IO.MemoryStream(abyt)
Me.PictureBox1.Image = Image.FromStream(ms) ' or any result other image
object

I am intrested in your drag code, may I see it, when not in this newsgroup
than by email.
My email adres is easy to translate I think.

Cor
 
* "LoSTMaN said:
I try to make a DragDrop to a Picturebox, to drag images from IE.
But i'm stuck here :
If (e.Data.GetDataPresent("DeviceIndependentBitmap")) Then
PictureBox1.Image =
e.Data.GetData("DeviceIndependentBitmap")
End If

The problem is, that a cannot make this because
e.Data.GetData("DeviceIndependentBitmap") is a memorystream, what can i do
to make a image with this ?

Untested (!):

\\\
Me.Picture1.Image = Image.FromStream(TheMemoryStream)
///
 
Damn, i'm still stuck at the same place.. ;o)
Everytme i play with memorystream i finish with an error.
So i'm back to the begining, maybe i will go back to Cobol instead of VB
;o)))

Private Overloads Sub PictureBox1_dragdrop(ByVal sender As Object, ByVal e
As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragDrop
Dim item As Object = CType(e.Data.GetData("DeviceIndependentBitmap"),
System.Object)
If (e.Data.GetDataPresent("DeviceIndependentBitmap")) Then
PictureBox1.Image = e.Data.GetData(DataFormats.Dib)
End If
End Sub
 
Hi Lostman,

You are talking about a memorystream, however I see no memorystream in your
message.

I do not know your problem direct, but when I translate it than I think it
has to be something like this.
\\\
Private Overloads Sub PictureBox1_dragdrop(ByVal sender As Object, ByVal e
As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragDrop
Dim abyt As Abyt = Directcaset(e.Data.GetData("DeviceIndependentBitmap"),
Byte())
Dim ms as New IO.MemoryStream(abyt)
PictureBox1.Image = Image.FromStream(ms)
End Sub
///

Casting to an object works always, however is not so usefull. I know that
you can use PIC for more things in Cobol, however presenting a picture is
more dificult in my opinion.

Cor
 
Back
Top