?
Solved

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

Posted on 2003-02-28
10
Medium Priority
?
270 Views
Last Modified: 2013-11-26
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
0
Comment
Question by:twinchouche
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 8042623
Clipboard.clear
Clipboard.setData Picture1.Picture

OR

Clipboard.setData Picture1.Image
0
 

Expert Comment

by:AnthonyBlake
ID: 8043580
copy the pointer to the image
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8044036
"copy the pointer to the image "
could you explain it a bit?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Expert Comment

by:MDockery
ID: 8044847
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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8044948
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
 

Author Comment

by:twinchouche
ID: 8055767
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
 

Author Comment

by:twinchouche
ID: 8056563
Besides, the contents of the picturebox are not drawings but other controls...
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 100 total points
ID: 8057511
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
 

Author Comment

by:twinchouche
ID: 8057980
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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8058030
I haven't to clarify anything but, it is not a limitation of picturebox but Windows API itself.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question