📄 parentframe.cs
字号:
this.dataGrid.GridLineStyle = System.Windows.Forms.DataGridLineStyle.None;
this.dataGrid.HeaderBackColor = System.Drawing.Color.MidnightBlue;
this.dataGrid.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGrid.HeaderForeColor = System.Drawing.Color.WhiteSmoke;
this.dataGrid.LinkColor = System.Drawing.Color.Teal;
this.dataGrid.Location = new System.Drawing.Point(0, 136);
this.dataGrid.Name = "dataGrid";
this.dataGrid.ParentRowsBackColor = System.Drawing.Color.Gainsboro;
this.dataGrid.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
this.dataGrid.ReadOnly = true;
this.dataGrid.SelectionBackColor = System.Drawing.Color.CadetBlue;
this.dataGrid.SelectionForeColor = System.Drawing.Color.WhiteSmoke;
this.dataGrid.Size = new System.Drawing.Size(752, 256);
this.dataGrid.TabIndex = 3;
//
// label2
//
this.label2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label2.Location = new System.Drawing.Point(0, 80);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(752, 56);
this.label2.TabIndex = 4;
//
// label3
//
this.label3.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label3.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.ForeColor = System.Drawing.Color.White;
this.label3.Location = new System.Drawing.Point(24, 96);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 23);
this.label3.TabIndex = 5;
this.label3.Text = "条件一:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textSearchA
//
this.textSearchA.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.textSearchA.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textSearchA.Cursor = System.Windows.Forms.Cursors.Hand;
this.textSearchA.ForeColor = System.Drawing.Color.White;
this.textSearchA.Location = new System.Drawing.Point(96, 96);
this.textSearchA.Name = "textSearchA";
this.textSearchA.Size = new System.Drawing.Size(112, 21);
this.textSearchA.TabIndex = 6;
this.textSearchA.Text = "";
this.textSearchA.MouseEnter += new System.EventHandler(this.textSearchB_MouseEnter);
this.textSearchA.MouseLeave += new System.EventHandler(this.textSearchB_MouseLeave);
//
// TextCheckBox
//
this.TextCheckBox.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.TextCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.TextCheckBox.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.TextCheckBox.ForeColor = System.Drawing.Color.White;
this.TextCheckBox.Location = new System.Drawing.Point(216, 96);
this.TextCheckBox.Name = "TextCheckBox";
this.TextCheckBox.Size = new System.Drawing.Size(72, 24);
this.TextCheckBox.TabIndex = 7;
this.TextCheckBox.Text = "条件二:";
this.TextCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textSearchB
//
this.textSearchB.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.textSearchB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textSearchB.ForeColor = System.Drawing.Color.White;
this.textSearchB.Location = new System.Drawing.Point(296, 96);
this.textSearchB.Name = "textSearchB";
this.textSearchB.Size = new System.Drawing.Size(112, 21);
this.textSearchB.TabIndex = 8;
this.textSearchB.Text = "";
this.textSearchB.MouseEnter += new System.EventHandler(this.textSearchB_MouseEnter);
this.textSearchB.MouseLeave += new System.EventHandler(this.textSearchB_MouseLeave);
//
// textSearchC
//
this.textSearchC.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.textSearchC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textSearchC.Cursor = System.Windows.Forms.Cursors.Hand;
this.textSearchC.ForeColor = System.Drawing.Color.White;
this.textSearchC.Location = new System.Drawing.Point(496, 96);
this.textSearchC.Name = "textSearchC";
this.textSearchC.Size = new System.Drawing.Size(112, 21);
this.textSearchC.TabIndex = 10;
this.textSearchC.Text = "";
this.textSearchC.MouseEnter += new System.EventHandler(this.textSearchB_MouseEnter);
this.textSearchC.MouseLeave += new System.EventHandler(this.textSearchB_MouseLeave);
//
// label4
//
this.label4.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label4.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label4.ForeColor = System.Drawing.Color.White;
this.label4.Location = new System.Drawing.Point(416, 96);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 23);
this.label4.TabIndex = 9;
this.label4.Text = "条件三:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnSearch
//
this.btnSearch.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearch.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnSearch.ForeColor = System.Drawing.Color.White;
this.btnSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnSearch.ImageIndex = 4;
this.btnSearch.ImageList = this.imageList;
this.btnSearch.Location = new System.Drawing.Point(632, 96);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(80, 24);
this.btnSearch.TabIndex = 11;
this.btnSearch.Text = "查询(&S)";
this.btnSearch.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnSearch.MouseEnter += new System.EventHandler(this.btnSearch_MouseEnter);
this.btnSearch.MouseLeave += new System.EventHandler(this.btnSearch_MouseLeave);
//
// ParentFrame
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(746, 423);
this.ControlBox = false;
this.Controls.Add(this.btnSearch);
this.Controls.Add(this.textSearchC);
this.Controls.Add(this.textSearchB);
this.Controls.Add(this.textSearchA);
this.Controls.Add(this.label4);
this.Controls.Add(this.TextCheckBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.dataGrid);
this.Controls.Add(this.status);
this.Controls.Add(this.tool);
this.Controls.Add(this.label1);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ParentFrame";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ParentFrame";
this.Load += new System.EventHandler(this.ParentFrame_Load);
((System.ComponentModel.ISupportInitialize)(this.statusText)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusDate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusUser)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusZhuangTai)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
this.ResumeLayout(false);
}
#endregion
#region 工具栏上事件...如下...
private void tool_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
try
{
if(e.Button.Text.ToString().Equals("首记录"))
{
this.dataGrid.UnSelect(this.cmOrders.Position);
this.cmOrders.Position=0;
this.dataGrid.Select(this.cmOrders.Position);
this.dataGrid.CurrentRowIndex=this.cmOrders.Position;
MessageBox.Show(this,"你已经到了记录开始了,无法继续向上移动了啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.toolFirst.Enabled=false;
this.toolLast.Enabled=false;
this.toolNext.Enabled=true;
this.toolEnd.Enabled=true;
return;
}
if(e.Button.Text.ToString().Equals("上一条记录"))
{
if(this.cmOrders.Position==0)
{
MessageBox.Show(this,"你已经到了记录开始了,无法继续向上移动了啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.toolFirst.Enabled=false;
this.toolLast.Enabled=false;
this.toolNext.Enabled=true;
this.toolEnd.Enabled=true;
}
else if(this.cmOrders.Position>0)
{
this.dataGrid.UnSelect(this.cmOrders.Position);
this.cmOrders.Position--;
this.dataGrid.Select(this.cmOrders.Position);
this.dataGrid.CurrentRowIndex=this.cmOrders.Position;
}
return;
}
if(e.Button.Text.ToString().Equals("下一条记录"))
{
if(this.cmOrders.Position.Equals(this.cmOrders.Count-1))
{
MessageBox.Show(this,"你已经到了最后一条记录,无法继续向下移啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.toolFirst.Enabled=true;
this.toolLast.Enabled=true;
this.toolNext.Enabled=false;
this.toolEnd.Enabled=false;
}
else if(this.cmOrders.Position<this.cmOrders.Count-1)
{
this.dataGrid.UnSelect(this.cmOrders.Position);
this.cmOrders.Position++;
this.dataGrid.Select(this.cmOrders.Position);
this.dataGrid.CurrentRowIndex=this.cmOrders.Position;
}
return;
}
if(e.Button.Text.ToString().Equals("尾记录"))
{
this.dataGrid.UnSelect(this.cmOrders.Position);
this.cmOrders.Position=this.cmOrders.Count-1;
this.dataGrid.Select(this.cmOrders.Position);
this.dataGrid.CurrentRowIndex=this.cmOrders.Position;
MessageBox.Show(this,"你已经到了最后一条记录,无法继续向下移啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.toolFirst.Enabled=true;
this.toolLast.Enabled=true;
this.toolNext.Enabled=false;
this.toolEnd.Enabled=false;
return;
}
if(e.Button.Text.Equals("查询"))
{
MessageBox.Show(this,"展开快捷菜单啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
if(e.Button.Text.Equals("清除历史"))
{
if(this.ds.Tables[0].Rows.Count>0)
{
this.cmOrders.RemoveAt(this.cmOrders.Position);
dataAdapter.Update(ds);
oleAdapter.Update(dataSet);
}
else
{
return;
}
return;
}
if(e.Button.Text.Equals("退出"))
{
DialogResult result=MessageBox.Show(this,"是否要关闭此窗体啦!!!","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
if(result.Equals(DialogResult.Yes))
{
Close();
}
else
{
return;
}
return;
}
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 查询...职工名称查询...
private void menuEmp_Name_Click(object sender, System.EventArgs e)
{
if(emp_timeStr.Equals(""))
{
return;
}
else if(emp_UncomeStr.Equals(""))
{
return;
}
else if(emp_LateStr.Equals(""))
{
return;
}
else if(emp_zhaoTuiStr.Equals(""))
{
return;
}
NameFrame log=new NameFrame();
log.ShowDialog();
}
#endregion
#region 查询...姓名查询...
private void menuDate_Click(object sender, System.EventArgs e)
{
DateFrame log=new DateFrame();
log.ShowDialog();
}
#endregion
#region 初始化...
private void ParentFrame_Load(object sender, System.EventArgs e)
{
try
{
#region 初始化状态栏...
this.statusDate.Text=System.DateTime.Now.ToLongDateString().Trim();
this.statusUser.Text=landFrame.strUserName.ToString().Trim();
#endregion
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 当前时间...
private void currentTime_Tick(object sender, System.EventArgs e)
{
this.statusTime.Text=System.DateTime.Now.ToLongTimeString().Trim();
}
#endregion
#region 光标移动变化....
private void textSearchB_MouseLeave(object sender, System.EventArgs e)
{
TextBox text=(TextBox)sender;
text.BackColor=System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
}
private void textSearchB_MouseEnter(object sender, System.EventArgs e)
{
TextBox text=(TextBox)sender;
text.BackColor=Color.White;
}
private void btnSearch_MouseLeave(object sender, System.EventArgs e)
{
Button button=(Button)sender;
button.FlatStyle=FlatStyle.Flat;
button.ForeColor=Color.White;
}
private void btnSearch_MouseEnter(object sender, System.EventArgs e)
{
Button button=(Button)sender;
button.FlatStyle=FlatStyle.Standard;
button.ForeColor=Color.Red;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -