Gizmo001 Posted December 27, 2002 Posted December 27, 2002 How do you copy the graphic contents of a panel or picturebox to the clipboard? The contents were prepared using createGraphics from System.Drawing.Graphics. Quote
*Experts* Nerseus Posted December 30, 2002 *Experts* Posted December 30, 2002 Have you tried the Clipboard object, part of System.Windows.Forms? -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Gizmo001 Posted December 30, 2002 Author Posted December 30, 2002 I don't have a problem posting a textbox or another control. I would like to post the entire graphic contents to the clipboard to paste in PowerPoint/Word/WordPerfect without changes in relative locations of the graphics. Thanks. Quote
*Experts* Nerseus Posted December 30, 2002 *Experts* Posted December 30, 2002 Assuming you're drawing to the Image portion of the pictureBox, you could try something like this: pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height); Graphics g = Graphics.FromImage(pictureBox1.Image); g.DrawLine(Pens.Red, 0, 0, 20, 20); g.Dispose(); Clipboard.SetDataObject(pictureBox1.Image, true); The first line creates a new Bitmap for the Image property. The next few lines simulate some drawing to the Image property (a simple red line in this case). The last line saves the bitmap to the clipboard, which is what I think you were asking...? -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Gizmo001 Posted December 30, 2002 Author Posted December 30, 2002 Thanks, I will try this out and get back. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.