📄 frmbillsmanagement.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
namespace SupermarketProject
{
/// <summary>
/// Summary description for frmBillsManagement.
/// </summary>
public class frmBillsManagement : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblBillNo;
private System.Windows.Forms.Label lblUser;
private System.Windows.Forms.Label lblBillDate;
private System.Windows.Forms.Label lblPayMode;
private System.Windows.Forms.TextBox txtBillNo;
private System.Windows.Forms.ComboBox cboPayMode;
private System.Windows.Forms.DateTimePicker dtpBillDate;
private System.Windows.Forms.Button btnSearch;
private System.Windows.Forms.ComboBox cboUsrId;
private System.Windows.Forms.DataGrid dbgBills;
private System.Windows.Forms.Button btnDetails;
private System.Windows.Forms.Button btnPrint;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Label lblHeading;
/// <summary>
/// Required designer variable.
public string[] searchvalue;
private DataGridPrinter dataGridPrinter = null;
public string[] dbgValue;
private System.Windows.Forms.HelpProvider hlpBillMgmt;
private System.Windows.Forms.ToolTip tipBillMgmt;
private System.Windows.Forms.CheckBox chkIncludeDate;
private System.Windows.Forms.ErrorProvider errBill;
private System.Windows.Forms.PrintDialog pdlgBills;
private System.Drawing.Printing.PrintDocument pDocBills;
private System.Windows.Forms.Button btnPrintPreview;
private System.Windows.Forms.PrintPreviewDialog ppdlgBills;
private System.ComponentModel.IContainer components;
private Settings settings;
public frmBillsManagement()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
settings = new Settings();
this.hlpBillMgmt.HelpNamespace = settings.uiDirectory+ @"\HELP\SupermarketHelp.chm";
//
// TODO: Add any constructor code after InitializeComponent call
//
searchvalue = new string[4];
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
[STAThread]
static void Main()
{
Application.Run(new frmBillsManagement());
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmBillsManagement));
this.lblHeading = new System.Windows.Forms.Label();
this.lblBillNo = new System.Windows.Forms.Label();
this.lblUser = new System.Windows.Forms.Label();
this.lblBillDate = new System.Windows.Forms.Label();
this.lblPayMode = new System.Windows.Forms.Label();
this.txtBillNo = new System.Windows.Forms.TextBox();
this.cboPayMode = new System.Windows.Forms.ComboBox();
this.dtpBillDate = new System.Windows.Forms.DateTimePicker();
this.btnSearch = new System.Windows.Forms.Button();
this.dbgBills = new System.Windows.Forms.DataGrid();
this.btnDetails = new System.Windows.Forms.Button();
this.btnPrint = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.cboUsrId = new System.Windows.Forms.ComboBox();
this.errBill = new System.Windows.Forms.ErrorProvider();
this.hlpBillMgmt = new System.Windows.Forms.HelpProvider();
this.tipBillMgmt = new System.Windows.Forms.ToolTip(this.components);
this.chkIncludeDate = new System.Windows.Forms.CheckBox();
this.pdlgBills = new System.Windows.Forms.PrintDialog();
this.pDocBills = new System.Drawing.Printing.PrintDocument();
this.btnPrintPreview = new System.Windows.Forms.Button();
this.ppdlgBills = new System.Windows.Forms.PrintPreviewDialog();
((System.ComponentModel.ISupportInitialize)(this.dbgBills)).BeginInit();
this.SuspendLayout();
//
// lblHeading
//
this.lblHeading.Location = new System.Drawing.Point(0, 0);
this.lblHeading.Name = "lblHeading";
this.lblHeading.TabIndex = 0;
//
// lblBillNo
//
this.lblBillNo.Location = new System.Drawing.Point(10, 11);
this.lblBillNo.Name = "lblBillNo";
this.lblBillNo.Size = new System.Drawing.Size(76, 17);
this.lblBillNo.TabIndex = 0;
this.lblBillNo.Text = "帐单编号";
//
// lblUser
//
this.lblUser.Location = new System.Drawing.Point(221, 8);
this.lblUser.Name = "lblUser";
this.lblUser.Size = new System.Drawing.Size(48, 24);
this.lblUser.TabIndex = 2;
this.lblUser.Text = "用户";
this.lblUser.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblBillDate
//
this.lblBillDate.Location = new System.Drawing.Point(384, 52);
this.lblBillDate.Name = "lblBillDate";
this.lblBillDate.Size = new System.Drawing.Size(67, 24);
this.lblBillDate.TabIndex = 5;
this.lblBillDate.Text = "帐单日期";
this.lblBillDate.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblPayMode
//
this.lblPayMode.Location = new System.Drawing.Point(624, 8);
this.lblPayMode.Name = "lblPayMode";
this.lblPayMode.Size = new System.Drawing.Size(96, 24);
this.lblPayMode.TabIndex = 7;
this.lblPayMode.Text = "付款方式";
this.lblPayMode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtBillNo
//
this.txtBillNo.Location = new System.Drawing.Point(86, 9);
this.txtBillNo.Name = "txtBillNo";
this.txtBillNo.Size = new System.Drawing.Size(120, 21);
this.txtBillNo.TabIndex = 1;
this.txtBillNo.Text = "";
this.txtBillNo.Validating += new System.ComponentModel.CancelEventHandler(this.txtBillNo_Validating);
this.txtBillNo.MouseHover += new System.EventHandler(this.txtBillNo_MouseHover);
//
// cboPayMode
//
this.cboPayMode.Location = new System.Drawing.Point(730, 9);
this.cboPayMode.Name = "cboPayMode";
this.cboPayMode.Size = new System.Drawing.Size(86, 20);
this.cboPayMode.TabIndex = 8;
this.cboPayMode.MouseHover += new System.EventHandler(this.cboPayMode_MouseHover);
//
// dtpBillDate
//
this.dtpBillDate.Enabled = false;
this.dtpBillDate.Location = new System.Drawing.Point(470, 52);
this.dtpBillDate.Name = "dtpBillDate";
this.dtpBillDate.Size = new System.Drawing.Size(221, 21);
this.dtpBillDate.TabIndex = 6;
this.dtpBillDate.MouseHover += new System.EventHandler(this.dtpBillDate_MouseHover);
//
// btnSearch
//
this.btnSearch.Location = new System.Drawing.Point(826, 9);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(90, 24);
this.btnSearch.TabIndex = 9;
this.btnSearch.Text = "搜索";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// dbgBills
//
this.dbgBills.BackgroundColor = System.Drawing.SystemColors.ActiveBorder;
this.dbgBills.DataMember = "";
this.dbgBills.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dbgBills.Location = new System.Drawing.Point(10, 95);
this.dbgBills.Name = "dbgBills";
this.dbgBills.PreferredColumnWidth = 120;
this.dbgBills.ReadOnly = true;
this.dbgBills.Size = new System.Drawing.Size(892, 232);
this.dbgBills.TabIndex = 10;
this.dbgBills.Click += new System.EventHandler(this.dbgBills_Click);
//
// btnDetails
//
this.btnDetails.Location = new System.Drawing.Point(38, 336);
this.btnDetails.Name = "btnDetails";
this.btnDetails.Size = new System.Drawing.Size(90, 34);
this.btnDetails.TabIndex = 11;
this.btnDetails.Text = "详细信息(&D)";
this.btnDetails.Click += new System.EventHandler(this.btnDetails_Click);
this.btnDetails.MouseHover += new System.EventHandler(this.btnDetails_MouseHover);
//
// btnPrint
//
this.btnPrint.Enabled = false;
this.btnPrint.Location = new System.Drawing.Point(154, 336);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(90, 34);
this.btnPrint.TabIndex = 12;
this.btnPrint.Text = "打印(&P)";
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(816, 336);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(90, 34);
this.btnExit.TabIndex = 14;
this.btnExit.Text = "退出(&X)";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// cboUsrId
//
this.cboUsrId.Location = new System.Drawing.Point(269, 9);
this.cboUsrId.Name = "cboUsrId";
this.cboUsrId.Size = new System.Drawing.Size(125, 20);
this.cboUsrId.TabIndex = 3;
this.cboUsrId.MouseHover += new System.EventHandler(this.cboUsrId_MouseHover);
//
// errBill
//
this.errBill.ContainerControl = this;
//
// tipBillMgmt
//
this.tipBillMgmt.AutomaticDelay = 150;
//
// chkIncludeDate
//
this.chkIncludeDate.Location = new System.Drawing.Point(422, 6);
this.chkIncludeDate.Name = "chkIncludeDate";
this.chkIncludeDate.Size = new System.Drawing.Size(183, 26);
this.chkIncludeDate.TabIndex = 4;
this.chkIncludeDate.Text = "包括搜索日期";
this.chkIncludeDate.CheckedChanged += new System.EventHandler(this.chkIncludeDate_CheckedChanged);
//
// pdlgBills
//
this.pdlgBills.Document = this.pDocBills;
//
// pDocBills
//
this.pDocBills.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.pDocBills_PrintPage);
//
// btnPrintPreview
//
this.btnPrintPreview.Enabled = false;
this.btnPrintPreview.Location = new System.Drawing.Point(269, 336);
this.btnPrintPreview.Name = "btnPrintPreview";
this.btnPrintPreview.Size = new System.Drawing.Size(90, 34);
this.btnPrintPreview.TabIndex = 13;
this.btnPrintPreview.Text = "打印预览(&R)";
this.btnPrintPreview.Click += new System.EventHandler(this.btnPrintPreview_Click);
//
// ppdlgBills
//
this.ppdlgBills.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.ppdlgBills.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.ppdlgBills.ClientSize = new System.Drawing.Size(400, 300);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -