📄 frmstockmanagement.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Drawing.Printing;
namespace SupermarketProject
{
/// <summary>
/// frmStockManagement
/// </summary>
public class frmStockManagement : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Button btnPrint;
private System.Windows.Forms.Button btnNew;
private System.Windows.Forms.Button btnSearch;
private System.Windows.Forms.DateTimePicker dtpStkDate;
private DataGridPrinter dataGridPrinter = null;
private System.Windows.Forms.Label lblStkDate;
private System.Windows.Forms.TextBox txtProdName;
private System.Windows.Forms.Label lblProdName;
private System.Windows.Forms.DataGrid dbgItemsList;
private System.Windows.Forms.ComboBox cboCatTitle;
private System.Windows.Forms.Label lblCatTitle;
private System.Windows.Forms.Button btnUpdate;
private System.Windows.Forms.CheckBox chkDate;
private System.Windows.Forms.HelpProvider hlpStockMgmt;
private System.Windows.Forms.ToolTip tipStockMgmt;
private System.Windows.Forms.PrintDialog pdlgStock;
private System.Drawing.Printing.PrintDocument pDoc;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Label lblHeading;
//other variables
public string[] searchvalue;
private System.Windows.Forms.Button btnPrintPreview;
private System.Windows.Forms.PrintPreviewDialog ppdlgStock;
private int stkid = 0;
private Settings settings;
public frmStockManagement()
{
//
// Windows
//
InitializeComponent();
settings =new Settings();
this.hlpStockMgmt.HelpNamespace=@"..\..\HELP\SupermarketHelp.chm";
//
// TODO: InitializeComponent
//
//Initializing the searchvalue
searchvalue = new string[3];
}
/// <summary>
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmStockManagement));
this.panel1 = new System.Windows.Forms.Panel();
this.btnExit = new System.Windows.Forms.Button();
this.btnPrint = new System.Windows.Forms.Button();
this.btnUpdate = new System.Windows.Forms.Button();
this.btnNew = new System.Windows.Forms.Button();
this.btnPrintPreview = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.chkDate = new System.Windows.Forms.CheckBox();
this.btnSearch = new System.Windows.Forms.Button();
this.dtpStkDate = new System.Windows.Forms.DateTimePicker();
this.lblStkDate = new System.Windows.Forms.Label();
this.cboCatTitle = new System.Windows.Forms.ComboBox();
this.lblCatTitle = new System.Windows.Forms.Label();
this.txtProdName = new System.Windows.Forms.TextBox();
this.lblProdName = new System.Windows.Forms.Label();
this.dbgItemsList = new System.Windows.Forms.DataGrid();
this.hlpStockMgmt = new System.Windows.Forms.HelpProvider();
this.tipStockMgmt = new System.Windows.Forms.ToolTip(this.components);
this.pdlgStock = new System.Windows.Forms.PrintDialog();
this.pDoc = new System.Drawing.Printing.PrintDocument();
this.lblHeading = new System.Windows.Forms.Label();
this.ppdlgStock = new System.Windows.Forms.PrintPreviewDialog();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dbgItemsList)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.btnExit);
this.panel1.Controls.Add(this.btnPrint);
this.panel1.Controls.Add(this.btnUpdate);
this.panel1.Controls.Add(this.btnNew);
this.panel1.Controls.Add(this.btnPrintPreview);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 373);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(784, 48);
this.panel1.TabIndex = 13;
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(544, 8);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(88, 32);
this.btnExit.TabIndex = 4;
this.btnExit.Text = "退出(&E)";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnPrint
//
this.btnPrint.Enabled = false;
this.btnPrint.Location = new System.Drawing.Point(216, 8);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(88, 32);
this.btnPrint.TabIndex = 2;
this.btnPrint.Text = "打印(&P)";
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
//
// btnUpdate
//
this.btnUpdate.Enabled = false;
this.btnUpdate.Location = new System.Drawing.Point(108, 8);
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(88, 32);
this.btnUpdate.TabIndex = 1;
this.btnUpdate.Text = "更新(&U)";
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
this.btnUpdate.MouseHover += new System.EventHandler(this.btnUpdate_MouseHover);
//
// btnNew
//
this.btnNew.Location = new System.Drawing.Point(8, 8);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(88, 32);
this.btnNew.TabIndex = 0;
this.btnNew.Text = "新建(&N)";
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
this.btnNew.MouseHover += new System.EventHandler(this.btnNew_MouseHover);
//
// btnPrintPreview
//
this.btnPrintPreview.Enabled = false;
this.btnPrintPreview.Location = new System.Drawing.Point(328, 8);
this.btnPrintPreview.Name = "btnPrintPreview";
this.btnPrintPreview.Size = new System.Drawing.Size(96, 32);
this.btnPrintPreview.TabIndex = 3;
this.btnPrintPreview.Text = "打印预览(&R)";
this.btnPrintPreview.Click += new System.EventHandler(this.btnPrintPreview_Click);
//
// panel2
//
this.panel2.Controls.Add(this.chkDate);
this.panel2.Controls.Add(this.btnSearch);
this.panel2.Controls.Add(this.dtpStkDate);
this.panel2.Controls.Add(this.lblStkDate);
this.panel2.Controls.Add(this.cboCatTitle);
this.panel2.Controls.Add(this.lblCatTitle);
this.panel2.Controls.Add(this.txtProdName);
this.panel2.Controls.Add(this.lblProdName);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(784, 80);
this.panel2.TabIndex = 0;
//
// chkDate
//
this.chkDate.Location = new System.Drawing.Point(512, 8);
this.chkDate.Name = "chkDate";
this.chkDate.Size = new System.Drawing.Size(144, 24);
this.chkDate.TabIndex = 4;
this.chkDate.Text = "包括搜索日期";
this.chkDate.MouseHover += new System.EventHandler(this.chkDate_MouseHover);
this.chkDate.CheckedChanged += new System.EventHandler(this.chkDate_CheckedChanged);
//
// btnSearch
//
this.btnSearch.Location = new System.Drawing.Point(656, 8);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(72, 22);
this.btnSearch.TabIndex = 7;
this.btnSearch.Text = "搜索";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// dtpStkDate
//
this.dtpStkDate.Enabled = false;
this.dtpStkDate.Location = new System.Drawing.Point(504, 48);
this.dtpStkDate.Name = "dtpStkDate";
this.dtpStkDate.Size = new System.Drawing.Size(168, 21);
this.dtpStkDate.TabIndex = 6;
this.dtpStkDate.MouseHover += new System.EventHandler(this.dtpStkDate_MouseHover);
//
// lblStkDate
//
this.lblStkDate.Enabled = false;
this.lblStkDate.Location = new System.Drawing.Point(432, 49);
this.lblStkDate.Name = "lblStkDate";
this.lblStkDate.Size = new System.Drawing.Size(64, 16);
this.lblStkDate.TabIndex = 5;
this.lblStkDate.Text = "库存日期";
this.lblStkDate.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// cboCatTitle
//
this.cboCatTitle.Location = new System.Drawing.Point(336, 8);
this.cboCatTitle.Name = "cboCatTitle";
this.cboCatTitle.Size = new System.Drawing.Size(124, 23);
this.cboCatTitle.TabIndex = 3;
this.cboCatTitle.MouseHover += new System.EventHandler(this.cboCatTitle_MouseHover);
//
// lblCatTitle
//
this.lblCatTitle.Location = new System.Drawing.Point(232, 8);
this.lblCatTitle.Name = "lblCatTitle";
this.lblCatTitle.Size = new System.Drawing.Size(94, 18);
this.lblCatTitle.TabIndex = 2;
this.lblCatTitle.Text = "类别名称";
this.lblCatTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtProdName
//
this.txtProdName.Location = new System.Drawing.Point(96, 8);
this.txtProdName.Name = "txtProdName";
this.txtProdName.Size = new System.Drawing.Size(96, 21);
this.txtProdName.TabIndex = 1;
this.txtProdName.Text = "";
this.txtProdName.MouseHover += new System.EventHandler(this.txtProdName_MouseHover);
//
// lblProdName
//
this.lblProdName.Location = new System.Drawing.Point(6, 8);
this.lblProdName.Name = "lblProdName";
this.lblProdName.Size = new System.Drawing.Size(82, 16);
this.lblProdName.TabIndex = 0;
this.lblProdName.Text = "产品名称";
this.lblProdName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// dbgItemsList
//
this.dbgItemsList.BackgroundColor = System.Drawing.SystemColors.Info;
this.dbgItemsList.DataMember = "";
this.dbgItemsList.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dbgItemsList.Location = new System.Drawing.Point(0, 112);
this.dbgItemsList.Name = "dbgItemsList";
this.dbgItemsList.PreferredColumnWidth = 120;
this.dbgItemsList.ReadOnly = true;
this.dbgItemsList.Size = new System.Drawing.Size(640, 250);
this.dbgItemsList.TabIndex = 1;
this.dbgItemsList.MouseHover += new System.EventHandler(this.dbgItemsList_MouseHover);
this.dbgItemsList.CurrentCellChanged += new System.EventHandler(this.dbgItemsList_CurrentCellChanged);
//
// hlpStockMgmt
//
this.hlpStockMgmt.HelpNamespace = "D:\\Project10102004\\HTM_FILES_FOR_HELP\\SUPERMARKETHELP.CHM";
//
// tipStockMgmt
//
this.tipStockMgmt.AutomaticDelay = 150;
//
// pdlgStock
//
this.pdlgStock.Document = this.pDoc;
//
// pDoc
//
this.pDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.pDoc_PrintPage);
//
// lblHeading
//
this.lblHeading.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(128)));
this.lblHeading.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblHeading.ForeColor = System.Drawing.Color.Maroon;
this.lblHeading.Location = new System.Drawing.Point(8, 0);
this.lblHeading.Name = "lblHeading";
this.lblHeading.Size = new System.Drawing.Size(504, 24);
this.lblHeading.TabIndex = 1;
this.lblHeading.Text = "Stock Information";
//
// ppdlgStock
//
this.ppdlgStock.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.ppdlgStock.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.ppdlgStock.ClientSize = new System.Drawing.Size(400, 300);
this.ppdlgStock.Document = this.pDoc;
this.ppdlgStock.Enabled = true;
this.ppdlgStock.Icon = ((System.Drawing.Icon)(resources.GetObject("ppdlgStock.Icon")));
this.ppdlgStock.Location = new System.Drawing.Point(426, 21);
this.ppdlgStock.MinimumSize = new System.Drawing.Size(375, 250);
this.ppdlgStock.Name = "ppdlgStock";
this.ppdlgStock.TransparencyKey = System.Drawing.Color.Empty;
this.ppdlgStock.Visible = false;
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -