📄 patientsearchframe.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Text;
using System.Windows.Forms;
using Youzi.BLL;
using Youzi.Model;
namespace Youzi.GuaHaoView
{
public partial class PatientSearchFrame : Form
{
public PatientSearchFrame()
{
InitializeComponent();
}
private void PatientSearchFrame_Load(object sender, EventArgs e)
{
PatientBLL bll = new PatientBLL();
PatientInfo entity = new PatientInfo();
string d = DateTime.Now.ToShortDateString();
string[] ss = d.Split('-'); //以'-'为分隔符,将分割后的字符串放到字符串数组里
string year = ss[0]; //year接受的是年 2008
string month = ss[1]; //month接受的是月 4
string day = ss[2]; //day接受的是天 12
if (month.Length == 1)
{
month = "0" + month;
}
if (day.Length == 1)
{
day = "0" + day;
}
string StartID = year + month + day + "0000";
string EndID = year + month + day + "9999";
DataSet ds = bll.SelectPatientToday(StartID,EndID);
dataGridView1.DataSource = ds.Tables[0];
}
private void Close_Click(object sender, EventArgs e)
{
this.Hide();
}
PageSettings pageSetting = new PageSettings();
private void PrintPriview_Click(object sender, EventArgs e)
{
//打印预览
PatientInfo entity = new PatientInfo();
PatientPrintDoc printDoc = new PatientPrintDoc(entity); //传一个实体过去
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = printDoc; //打印预览对话框显示的文档来源于printDoc
ppd.Document.DefaultPageSettings = pageSetting;
//开始预览
ppd.ShowDialog();
}
private void SetupSetting_Click(object sender, EventArgs e)
{
//页面设置
PageSetupDialog psd = new PageSetupDialog();
psd.PageSettings = pageSetting;
psd.ShowDialog();
}
private void Print_Click(object sender, EventArgs e)
{
//打印
PatientInfo entity = new PatientInfo();
PatientPrintDoc printDoc = new PatientPrintDoc(entity); //传一个实体过去
PrintDialog pd = new PrintDialog();
pd.Document = printDoc;
//设置打印的页面设置
pd.Document.DefaultPageSettings = pageSetting;
DialogResult dr= pd.ShowDialog();
if (dr == DialogResult.Cancel)
{
return;
}
else
{
printDoc.Print();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -