Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

Have you tried the Clipboard object, part of System.Windows.Forms?

 

-ner

"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
Posted

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.

  • *Experts*
Posted

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

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...