首页 新闻 赞助 找找看

winform写了一个类似Visio的画图软件,想要打印出picturebox,求教高手给出思路或者代码!!

0
悬赏园豆:20 [已关闭问题] 关闭于 2014-01-02 17:41

          

这是我用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));
        }

           

lijunmomo的主页 lijunmomo | 初学一级 | 园豆:34
提问于:2013-12-15 13:53
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册