프린터 출력 및 페이지 설정 예제 소스입니다.
아래의 소스는 폼 크기, 페이지 설정에 맞게 프린터 출력이 되는 걸 확인 할 수 있습니다.
using System.Drawing.Printing;
private void button1_Click(object sender, EventArgs e)
{
PrintDocument printDocument1 = new PrintDocument();
printDocument1.PrintPage += new PrintPageEventHandler(this.printDocument1_PrintPage);
printDocument1.PrinterSettings.Copies = 1;
PageSetupDialog pageSetup = new PageSetupDialog();
pageSetup.Document = printDocument1;
pageSetup.PageSettings = printDocument1.DefaultPageSettings;
if (pageSetup.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
printDocument1.Print();
}
}
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(bmpImage, 0, 0);
this.DrawToBitmap(bmpImage, new Rectangle(0, 0, this.Width, this.Height));
e.Graphics.DrawImage(bmpImage, 0, 0);
}
'C#' 카테고리의 다른 글
[C#/PDA]PDA 프로그램 중복 실행 방지 예제 (0) | 2016.01.21 |
---|---|
[C#/PDA]RAPI를 이용한 PC와 PDA간 파일 송수신 예제 소스 (0) | 2016.01.21 |
[C#/PDA]키보드 IME MODE 변환 예제 소스 (0) | 2016.01.21 |
[C#/PDA]ComboBox Binding 예제 소스 (0) | 2016.01.21 |
[C#]ProgressBar Value 100% 구하기 공식 (0) | 2016.01.19 |