C#
25.C#_WinForm - 인쇄 미리보기 ( Print Preview )
Godffs
2009. 8. 31. 22:03
반응형
C# 인쇄 미리보기 예제입니다.
24장 간단한 메모장에서 추가 하겠습니다.
FrmMain - 샘플 - 간단한메모장
FrmSampleNotepad.Designer.cs |
![]()
|
FrmSampleNotepad.cs |
using System.Drawing.Drawing2D; //네임스페이스 추가 private void btnPrintView_Click(object sender, EventArgs e) { this.printPreviewDialog.Document = this.printDocument; this.printPreviewDialog.ShowDialog(); } //PrintDocument 이벤트 속성 - PrintPage 추가 private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Pen p = new Pen(Color.Blue, 5); p.Alignment = PenAlignment.Inset; e.Graphics.DrawRectangle(p, e.MarginBounds); Font F = new Font("바탕", 12); e.Graphics.DrawString(txtNote.Text, F, Brushes.Black, e.MarginBounds.Left + 100, e.MarginBounds.Top + 100); } |
결과확인 |
![]() |
25WinFrmMain.zip
다운로드
반응형