📄 frmfailure.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using GoldPrinter;
namespace GEROSYS
{
/// <summary>
/// frmFailure 的摘要说明。
/// </summary>
public class frmFailure : System.Windows.Forms.Form
{
// protected const string SQL_CONNECTION_STRING = @"Data Source=diaodushi;DataBase=gero;user id=sa;password=sasa";
protected const string SQL_CONNECTION_STRING = @"Server=(local)\PCMS;DataBase=gero;user id=sa;password=pcms;Integrated Security=SSPI";
private string strConn= new AccessData().ConnectionString ;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.ToolBar toolBar1;
private System.Windows.Forms.ToolBarButton toolBarFresh;
private System.Windows.Forms.ToolBarButton toolBarPrintV;
private System.Windows.Forms.ToolBarButton toolBarPrint;
private System.Windows.Forms.ToolBarButton toolBarExit;
private System.Windows.Forms.GroupBox groupBox11;
private System.Windows.Forms.Label lblAStart;
private System.Windows.Forms.DateTimePicker dtpAStart;
private System.ComponentModel.IContainer components;
private frmFailureGP frm;
private AxVSFlex7.AxVSFlexGrid grdRAccept;
private DataTable dtTable=new DataTable();
private DataRow myDataRow;
public string[,] arrstrGrd = new string[6,1];
public frmFailure()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
[STAThread]
static void Main()
{
Application.Run(new frmFailure());
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmFailure));
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.toolBar1 = new System.Windows.Forms.ToolBar();
this.toolBarFresh = new System.Windows.Forms.ToolBarButton();
this.toolBarPrintV = new System.Windows.Forms.ToolBarButton();
this.toolBarPrint = new System.Windows.Forms.ToolBarButton();
this.toolBarExit = new System.Windows.Forms.ToolBarButton();
this.groupBox11 = new System.Windows.Forms.GroupBox();
this.lblAStart = new System.Windows.Forms.Label();
this.dtpAStart = new System.Windows.Forms.DateTimePicker();
this.grdRAccept = new AxVSFlex7.AxVSFlexGrid();
this.groupBox11.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.grdRAccept)).BeginInit();
this.SuspendLayout();
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// toolBar1
//
this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.toolBarFresh,
this.toolBarPrintV,
this.toolBarPrint,
this.toolBarExit});
this.toolBar1.DropDownArrows = true;
this.toolBar1.ImageList = this.imageList1;
this.toolBar1.Location = new System.Drawing.Point(0, 0);
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new System.Drawing.Size(776, 41);
this.toolBar1.TabIndex = 6;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// toolBarFresh
//
this.toolBarFresh.ImageIndex = 4;
this.toolBarFresh.Text = "查询";
this.toolBarFresh.ToolTipText = "查询";
//
// toolBarPrintV
//
this.toolBarPrintV.ImageIndex = 5;
this.toolBarPrintV.Text = "预览";
this.toolBarPrintV.ToolTipText = "预览";
//
// toolBarPrint
//
this.toolBarPrint.ImageIndex = 6;
this.toolBarPrint.Text = "打印";
this.toolBarPrint.ToolTipText = "打印";
//
// toolBarExit
//
this.toolBarExit.ImageIndex = 7;
this.toolBarExit.Text = "退出";
this.toolBarExit.ToolTipText = "退出";
//
// groupBox11
//
this.groupBox11.BackColor = System.Drawing.SystemColors.Window;
this.groupBox11.Controls.Add(this.lblAStart);
this.groupBox11.Controls.Add(this.dtpAStart);
this.groupBox11.Location = new System.Drawing.Point(536, 40);
this.groupBox11.Name = "groupBox11";
this.groupBox11.Size = new System.Drawing.Size(240, 48);
this.groupBox11.TabIndex = 10;
this.groupBox11.TabStop = false;
//
// lblAStart
//
this.lblAStart.Location = new System.Drawing.Point(8, 16);
this.lblAStart.Name = "lblAStart";
this.lblAStart.Size = new System.Drawing.Size(72, 23);
this.lblAStart.TabIndex = 1;
this.lblAStart.Text = "接警日期:";
this.lblAStart.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// dtpAStart
//
this.dtpAStart.Location = new System.Drawing.Point(80, 16);
this.dtpAStart.Name = "dtpAStart";
this.dtpAStart.Size = new System.Drawing.Size(152, 21);
this.dtpAStart.TabIndex = 0;
//
// grdRAccept
//
this.grdRAccept.DataSource = null;
this.grdRAccept.Location = new System.Drawing.Point(0, 96);
this.grdRAccept.Name = "grdRAccept";
this.grdRAccept.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("grdRAccept.OcxState")));
this.grdRAccept.Size = new System.Drawing.Size(816, 264);
this.grdRAccept.TabIndex = 33;
//
// frmFailure
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(776, 413);
this.Controls.Add(this.grdRAccept);
this.Controls.Add(this.groupBox11);
this.Controls.Add(this.toolBar1);
this.Name = "frmFailure";
this.Text = "急抢修故障月分析";
this.Closing += new System.ComponentModel.CancelEventHandler(this.frmFailure_Closing);
this.Load += new System.EventHandler(this.frmFailure_Load);
this.groupBox11.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.grdRAccept)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void frmFailure_Load(object sender, System.EventArgs e)
{
this.Top = 0;
this.Left = 0;
this.Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height / 2;
groupBox11.Left = 500;
grdRAccept.Width =this.Width ;
grdRAccept.Height =this.Height -10;
System.DateTime dateTime = new System.DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month,01);
dtpAStart.Value = dateTime;
// dtpAStart.Format=DateTimePickerFormat.Custom;
// dtpAStart.CustomFormat = "yyyyMM";
grdRAccept.SheetBorder =Color.White;
grdRAccept.RowHeightMin =250;
grdRAccept.RowHeightMax =300;
grdRAccept.AllowSelection =false;
grdRAccept.MergeCells= VSFlex7.MergeSettings.flexMergeFree;
grdRAccept.MergeCompare = VSFlex7.MergeCompareSettings.flexMCExact;
grdRAccept.set_MergeCol(0,true);
grdRAccept.set_MergeCol(1,true);
grdRAccept.set_Cell(VSFlex7.CellPropertySettings.flexcpAlignment,0,0,4,4,VSFlex7.AlignmentSettings.flexAlignCenterCenter);
if(this.frm == null)
{
frm = new frmFailureGP(this);
}
else
{
this.frm.Dispose();
this.frm=null;
frm = new frmFailureGP(this);
}
frm.Show();
frm.CreateAllCharts(0);
}
private void frmFailure_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if(!(this.frm == null))
{
this.frm.Dispose();
this.frm = null;
}
}
#region 工具条按钮处理
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
switch(toolBar1.Buttons.IndexOf(e.Button))
{
case 0: //查询
{
QueryReport();
break;
}
case 1: //打印预览
{
this.Print(false);
break;
}
case 2: //打印
{
this.Print(true);
break;
}
case 3: //退出
{
this.Close();
if(!(this.frm == null))
{
this.frm.Dispose();
this.frm = null;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -