private void saveAsPngToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "PNG|*.png";
dialog.FileName = lastSelected;
if (dialog.ShowDialog() == DialogResult.OK)
{
using (this.Graphics1 = this.CreateGraphics())
using (Surface1 = new Win32Surface(Graphics1.GetHdc()))
using (Context1 = new Context(Surface1))
{
Surface1.WriteToPng(dialog.FileName);
}
}
}