- int m_curPage = 2;
- PrintDocument myPrintDoc = new PrintDocument();
- myPrintDoc.DefaultPageSettings.PaperSize = new PaperSize("default",
- textControl1.PageSize.Width,
- textControl1.PageSize.Height);
- myPrintDoc.DefaultPageSettings.Margins = new Margins(textControl1.PageMargins.Left,
- textControl1.PageMargins.Right,
- textControl1.PageMargins.Top,
- textControl1.PageMargins.Bottom);
- myPrintDoc.PrinterSettings.PrintRange = PrintRange.SomePages;
- myPrintDoc.PrinterSettings.FromPage = m_curPage;
- myPrintDoc.PrinterSettings.ToPage = m_curPage;
- textControl1.Print(myPrintDoc);
复制代码 |