PC Review


Reply
Thread Tools Rate Thread

DIB - Memorystream

 
 
LoSTMaN
Guest
Posts: n/a
 
      15th May 2004
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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?QW5hbmRbTVZQfQ==?=
Guest
Posts: n/a
 
      15th May 2004
Use the System.Drawing.Bitmap class. It has a constructor that accepts a stream object.

--
Regards,
Anand M
VB.NET MVP

http://www.dotnetindia.com


"LoSTMaN" wrote:

> 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
>
>
>

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      16th May 2004
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




 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      16th May 2004
* "LoSTMaN" <(E-Mail Removed)> scripsit:
> 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)
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      16th May 2004
Hi Herfried,

Those nice mountains in .........................echo

:-)

Cor


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      16th May 2004
* "Cor Ligthert" <(E-Mail Removed)> scripsit:
> Those nice mountains in .........................echo


No, if there is no byte array...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      16th May 2004
See the last row in my message, exactly the same



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      16th May 2004
* "Cor Ligthert" <(E-Mail Removed)> scripsit:
> See the last row in my message, exactly the same


....

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
LoSTMaN
Guest
Posts: n/a
 
      18th May 2004
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


"Cor Ligthert" <(E-Mail Removed)> a écrit dans le message de
news:Oneh%23$(E-Mail Removed)...
> 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
>
>
>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      18th May 2004
* "LoSTMaN" <(E-Mail Removed)> scripsit:
> Damn, i'm still stuck at the same place.. ;o)
> Everytme i play with memorystream i finish with an error.


What error?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MemoryStream bug? Don Microsoft VB .NET 13 7th Jul 2005 05:22 PM
MemoryStream?? Charles A. Lackman Microsoft Dot NET 6 11th Feb 2005 09:15 PM
MemoryStream?? Charles A. Lackman Microsoft Dot NET Framework Forms 4 11th Feb 2005 06:31 PM
MemoryStream Jeroen Ceuppens Microsoft Dot NET Compact Framework 1 23rd Dec 2003 01:10 AM
MemoryStream Eduardo Pavinato Klein Microsoft Dot NET Compact Framework 0 24th Sep 2003 07:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:07 AM.