ControlPrint mp = new ControlPrint(panel1); mp.PrintWidth = mp.CalculateSize().Width; mp.PrintHeight = mp.CalculateSize().Height; PrintDialog PrintDialog1 = new PrintDialog(); System.Drawing.Printing.PrintDocument docToPrint = new System.Drawing.Printing.PrintDocument(); PrintDialog1.AllowSomePages = true; PrintDialog1.ShowHelp = true; PrintDialog1.Document = docToPrint; DialogResult result = PrintDialog1.ShowDialog(); if (result == DialogResult.OK) { docToPrint.Print(); }
public void StartPrint(Stream streamToPrint, string streamType) { this.printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage); this.streamToPrint = streamToPrint; this.streamType = streamType; System.Windows.Forms.PrintDialog PrintDialog1 = new PrintDialog(); PrintDialog1.AllowSomePages = true; PrintDialog1.ShowHelp = true; PrintDialog1.Document = printDocument1; DialogResult result = PrintDialog1.ShowDialog(); if (result == DialogResult.OK) { printDocument1.Print(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)