Solved

Saving on a drawn on control

Posted on 2004-10-10
3
186 Views
Last Modified: 2012-05-05
Ok I have a control that I draw ontop of by overriding the paint method now I want to save a bmp or jpg of the control with the edits ontop of it. Whenever I use the graphics save method though I get either one layer (the original image) or the edits (my draw changes).

How can I save both layers to one images?
0
Comment
Question by:toby_lang
[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
3 Comments
 
LVL 11

Accepted Solution

by:
Agarici earned 125 total points
ID: 12274580
try something like this:

private void OnPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
   MyDrawChanges( e.Graphics );
}

private void MyDrawChanges( Graphics g )
{
// do your edits here
}

// and save all your drawing like this
public void Save(string FileName)
{
 Btimap bmp = new Bitmap(YourOriginalImage);
 Graphics g = Graphics.FromImage(bmp);
 MyDrawChanges( g );
 
 bmp.Save(FileName);  
}


hth,
A.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

763 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