Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Saving on a drawn on control

Posted on 2004-10-10
3
Medium Priority
?
192 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
3 Comments
 
LVL 11

Accepted Solution

by:
Agarici earned 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

886 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