By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,698 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,698 IT Pros & Developers. It's quick & easy.

Image won't copy to clipboard from picturebox

P: n/a
Hi--

I am using VB.Net 2002 for this app. I am working with Tiff and jpeg
images. I have a picturebox set up that I use to view the images. I
have the picture box inside of a scrollable panel.There are two viewing
preferences available: to view the image with scrollbars (the original
image unsized), and to view the iamge without scrollbars (the image
resized to fit within the panel's viewing range.) When I resize the
image so that the entire image is contained in the picture box (without
scrollbars) then the image copies to the clipboard correctly every
time. But, when I view the image in the picture box so that it has
scroll bars on it, when I copy the image to the clipboard it sometime
works, and sometimes doesn't. If it doens't work, I can't paste the
contents into anything else: When I copy the image to a Word doc, I
get nothing, no errors, no image, nothing. When I copy the image into
Paint, I get an error that tells me that it failed to retreive the data
from the clipboard.
I find that this randomly errors, I can't see any correlation as to
what causes it to NOT work. At times it will work with no problems,
at others I can't copy a thing. The only thing consistent about either
situation, is that for the current session it either always works, or
it never works.

I've tried restarting my machine, sometimes this fixes the problem, but
sometimes it doesn't.

Mycode for copying to the clipboard is this:
System.Windows.Forms.Clipboard.SetDataObject(pbox Viewer.Image)<

For now I have been unable to track this problem down so that I can
correct it. I am unhappy about this. Are there any workarounds so
that I can guarantee that the function will always work correctly? I
wrote this app a while ago, and when I originally did intense testing,
this problem did not exist. I am able to duplicate these results on
multiple machines, so I know that it is not just me. Please let me
know if there are any patches that are available to fix this.

--Thanks,
mhos

Feb 15 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.