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 10 4526
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
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" <lo*****@cablevision.qc.ca> 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/>
Hi Herfried,
Those nice mountains in .........................echo
:-)
Cor
* "Cor Ligthert" <no**********@planet.nl> scripsit: Those nice mountains in .........................echo
No, if there is no byte array...
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
See the last row in my message, exactly the same
* "Cor Ligthert" <no**********@planet.nl> scripsit: See the last row in my message, exactly the same
....
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
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" <no**********@planet.nl> a écrit dans le message de
news:On****************@TK2MSFTNGP09.phx.gbl... 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" <lo*****@cablevision.qc.ca> 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/>
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("DeviceIndependentBitma p"),
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 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: xmlguy |
last post by:
PREVIOUS BACKGROUND POST:
I am trying to reuse a Memory Stream for loading and
transforming the xml it contains
Basically I have defined following interfaces:
Class Render
{
|
by: Arcnet |
last post by:
Using MemoryStream
I Have a problem to create a new Image from byte array that originaly
was created from an older image
(Everything is being preformed in the same Thread)
//Get Image...
|
by: Nicolas |
last post by:
Hi Everybody, I'm working with the MemoryStream and I'm having
problems with the ReadBytes method. When I use it, this method never
returns bytes!!!!
MemoryStream sw = new MemoryStream();...
|
by: SQLScott |
last post by:
For some reason I am drawing a blank on this, so I would be extremely
greatful if someone could help me out.
I am trying to get a MemoryStream out of a Byte array. How do I get it back
out?
...
|
by: Don |
last post by:
When I run the following code, the MemoryStream's Position is always set to
762 instead of 0, which is what I would expect:
Dim bmp As Image
Dim ms As MemoryStream
bmp = New...
|
by: Asaf |
last post by:
Hi,
I am trying to Compress & Decompress a DataSet.
When running this code I am receiving the error:
System.Xml.XmlException was unhandled
Message="Root element is missing."...
|
by: Heron |
last post by:
Hi,
Could someone explain me why the following code doesn't work? The
memorystream always remains with length 0.
MemoryStream input = new MemoryStream();
|
by: |
last post by:
Hi all,
I want to create a method that does the following:
1) Programmatically instantiate a new XmlDataSource control
2) For each file in a named directory, make a "FileSystemItem" element
3)...
|
by: =?Utf-8?B?UGhpbCBKb2huc29u?= |
last post by:
Hi,
I am using dotnet remoting with a binarry formatter.
I have a property that returns a memorystream that has had a file loaded
into it.
When I try to access this property though I get an...
|
by: =?Utf-8?B?VmljdG9y?= |
last post by:
Hi,
Could you tell me can I keep the MemoryStream open and "close" the
BinaryReader?
As the MemoryStream is used for buffering the TCP data and BinaryReader is
only used to read the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |