Save the Form & other controls as Bitmap[
^]
This code is checked and working at least for me. Also provided example of SaveFileDialog usage.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Load+=new EventHandler(Form1_Load);
}
private void Form1_Load(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
SaveAsBitmap(this, saveFileDialog.FileName);
}
}
public void SaveAsBitmap(Control control, string fileName)
{
Graphics g = control.CreateGraphics();
Bitmap bmp = new Bitmap(control.Width, control.Height);
control.DrawToBitmap(bmp, new Rectangle(0, 0, control.Width, control.Height));
bmp.Save(fileName);
bmp.Dispose();
}
}