471,306 Members | 848 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

Clipboard Image Data

Earlier in VB6, the image was copied onto the clipboard from the Image
Processing Program . This image would then be loaded onto the image control
on the VB form using GetData() function.
In VB.NET there is no image control for one and I get a type cast error
while trying to save the contents of the clipboard using GetData() as an image

Any help on this?

VBUser
Jul 21 '05 #1
1 1789
In article <C7**********************************@microsoft.co m>,
VB****@discussions.microsoft.com says...
Earlier in VB6, the image was copied onto the clipboard from the Image
Processing Program . This image would then be loaded onto the image control
on the VB form using GetData() function.
In VB.NET there is no image control for one and I get a type cast error
while trying to save the contents of the clipboard using GetData() as an image


For the image, use a PictureBox control. To find out if the clipboard
has a bitmap on it and to pull that bitmap off into the picturebox, use:

Dim data As IDataObject = Clipboard.GetDataObject()

If data.GetDataPresent(DataFormats.Bitmap) Then
Dim img As Image = DirectCast(data.GetData(DataFormats.Bitmap),
Image)
Me.ClientSize = img.Size
PictureBox1.Location = New Point(0, 0)
PictureBox1.Size = img.Size
PictureBox1.Image = img
End If

This is from the "Form_Load" of a quick windows app I did.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by andrew | last post: by
3 posts views Thread by Scott Friedrich | last post: by
7 posts views Thread by lgbjr | last post: by
1 post views Thread by VB User | last post: by
reply views Thread by mhospodarsky | last post: by
5 posts views Thread by exhuma.twn | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.