How to copy the content of a PictureBox to the clipboard???

I've got a picture box that I use as a container and I'd like to copy its content to the clipboard. It's fine if I use this picture box as a picture but not as a container... Please help !! Thanx
twinchoucheAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bobbit31Commented:
Clipboard.clear
Clipboard.setData Picture1.Picture

OR

Clipboard.setData Picture1.Image
0
AnthonyBlakeCommented:
copy the pointer to the image
0
Richie_SimonettiIT OperationsCommented:
"copy the pointer to the image "
could you explain it a bit?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

MDockeryCommented:
If by the contents of the picture box you mean to grab an image of all the objects in it, then try the BitBlt function. This will grab a graphical representation of an area of the screen. Then you may do with it as as want.

Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

Private Sub Command1_Click()
BitBlt Picture2.hDC, 0, 0, Picture1.Width, Picture1.Height, Picture1.hDC, 0, 0, vbSrcCopy
Picture2.Refresh  'Picture2 has AutoRedraw as True
End Sub
0
Richie_SimonettiIT OperationsCommented:
I think you don't need bitblt since he needs to copy to clipboard not another control.
To me, one of both  bobbit's suggestion should do the job.
0
twinchoucheAuthor Commented:
Actually, the problem is the following. I'd like to copy the entire contents of a picturebox. Most of the time, the contents of this picturebox are wider than what is actually displayed on the screen and I want to copy to the clipboard the ENTIRE content of the picturebox.
It seems that the code given by MDockery copies only the contents of the picturebox actually displayed on the screen.
0
twinchoucheAuthor Commented:
Besides, the contents of the picturebox are not drawings but other controls...
0
Richie_SimonettiIT OperationsCommented:
The problem is, as long as i know, that there is no way you could use to get a bitmap/picture that is not totally visible. Windows doesn't knows which is "behind the scenes".
I think that, to it, which is not visible doesn't exist.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
twinchoucheAuthor Commented:
I think you're right Richie. I just read an article about VB pictureboxes and this is one of their limitations.
Thanx guys for your comments.
0
Richie_SimonettiIT OperationsCommented:
I haven't to clarify anything but, it is not a limitation of picturebox but Windows API itself.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.