Click here to Skip to main content
15,922,696 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi dears.

I have a form that with some content that I want to allow my users to save as a bitmap or jpeg. I have a Save button that when the user clicks it, like to take a snapshot of that form content (without border and controlbox) and have a Save File Dialog open up that allows the user to decide where they want to save the file.

Please explain your solution,i'm new in C#.
Posted
Comments
OriginalGriff 7-Aug-12 7:10am    
And what have you tried?
Where are you stuck?

What about Set border to 0 and ControBox to False just before save it. Set border to 1 and ControlBox to True after saved it. I assumed that you're windows forms developer.

Hope it helps.
 
Share this answer
 
v2
Comments
siasalar 8-Aug-12 0:46am    
ok but how can i save the form?
mmm3743 8-Aug-12 4:04am    
Good idea
I had the same problem.Here is what I did:

1)Put Everything inside a panel

2)Use Code:

C#
private void SaveToImage(string FilePath)
{
     Bitmap a = new Bitmap(panel1.Width, panel1.Height);
     panel1.DrawToBitmap(a, new Rectangle(0, 0, panel1.Width, panel1.Height));
     a.Save(FilePath);
}
 
Share this answer
 
v2
Comments
siasalar 8-Aug-12 0:46am    
A generic error occurred in GDI+.
mmm3743 8-Aug-12 4:01am    
I don't know why that error occurred, but I have forgotten that code I wrote was to save panel in case it's docked. I've changed code so that panel doesn't have to be docked, and tested it, and it works on my pc.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900