c# winform 打印图像,PrintDialog打印并且设置打印纸张大小

 //按下打印按钮
     private void button3_Click(object sender, EventArgs e)
        {
            //打印图像
        //显示打印设置对话框
        PrintDialog MySettings = new PrintDialog();
            MySettings.Document = this.printDocument1;

            PaperSize p = null;
            foreach (PaperSize ps in MySettings.Document.PrinterSettings.PaperSizes)
            {
                if (ps.PaperName.Equals("A2"))//这里设置纸张大小,但必须是定义好的
                    p = ps;
            }
            MySettings.Document.DefaultPageSettings.PaperSize = p;
            if (MySettings.ShowDialog() == DialogResult.OK)
            {
                this.printDocument1.Print();
            }
        }

 黑色头发:http://heisetoufa.iteye.com

你可能感兴趣的:(C++,c,C#,WinForm)