?? patientprintdoc.cs
字號:
?using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Printing;
using Youzi.Model;
namespace Youzi.GuaHaoView
{
public class PatientPrintDoc:PrintDocument
{
Font font = null;
private string PatientID; //病人編號
private string PatientName; //病人姓名
private string PatientSex; //病人性別
private string PatientAge; //病人年齡
private string Department; //工作單位
private string Address; //病人地址
private string OperateDate; //操作時間
private string Operator; //操作員
public PatientPrintDoc(PatientInfo entity) //構造函數
{
this.PatientID = entity.PatientID;
this.PatientName = entity.PatientName;
this.PatientSex = entity.PatientSex;
this.PatientAge = entity.PatientAge;
this.Department = entity.Department;
this.Address = entity.Address;
this.OperateDate = entity.OperateDate;
this.Operator = entity.Operator;
}
protected override void OnBeginPrint(PrintEventArgs e)
{
font = new Font("宋體", 15);
}
protected override void OnPrintPage(PrintPageEventArgs e)
{
e.Graphics.DrawString("今日病人信息", new Font("宋體", 20, FontStyle.Bold), Brushes.Black, 300, 60);
e.Graphics.DrawString("病人編號", font, Brushes.Black, 20, 100);
e.Graphics.DrawString("病人姓名", font, Brushes.Black, 120, 100);
e.Graphics.DrawString("病人性別", font, Brushes.Black, 220, 100);
e.Graphics.DrawString("病人年齡", font, Brushes.Black, 320, 100);
e.Graphics.DrawString("工作單位", font, Brushes.Black, 420, 100);
e.Graphics.DrawString("病人地址", font, Brushes.Black, 520, 100);
e.Graphics.DrawString("操作時間", font, Brushes.Black, 620, 100);
e.Graphics.DrawString("操作員", font, Brushes.Black, 720, 100);
}
protected override void OnEndPrint(PrintEventArgs e)
{
font = null;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -