private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Bitmap bit = new Bitmap(this.Width, this.Height);
this.MdPanel.DrawToBitmap(bit, new Rectangle(0, 0, this.Width, this.Height));
e.Graphics.DrawImage(bit, 0, 0);
bit.Dispose();
}
private void FormExpress_Shown(object sender, EventArgs e)
{
//打印
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
//pd.Print();
if (printpreview == true)
{
PrintPreviewDialog cppd = new PrintPreviewDialog();
cppd.Document = pd;
cppd.ShowDialog();
}
else
{
pd.Print();
}
this.Close();
}