这是我用winform做的程序的画板,这些控件都是自己用GDI画的,黑色部分为picturebox控件,里面的图框是我自定义的控件类
有哪位高手帮帮忙???,我已经写出来了,但是不打印??代码如下,只是显示正在打印,还出现选择文件的对话框,不需要这个。。。直接打印
//打印按钮
private void toolStripButton10_Click(object sender, EventArgs e)
{
PrintDialog myDialog = new PrintDialog();
myDialog.Document = printDocument1;
if (myDialog.ShowDialog() == DialogResult.OK)
{
try
{
printDocument1.Print();
}
catch
{
printDocument1.PrintController.OnEndPrint(printDocument1, new System.Drawing.Printing.PrintEventArgs());
}
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
DrawForm df = (DrawForm)(dockPanel1.ActiveDocument);
e.Graphics.DrawImage(df.pictureBox.Image,new Point(0,0));
}