Image won't copy to clipboard from picturebox

M

mhospodarsky

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(pboxViewer.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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top