Solved

Saving on a drawn on control

Posted on 2004-10-10
3
182 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 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now