📄 parentframe.cs
字号:
this.status.Size = new System.Drawing.Size(862, 32);
this.status.TabIndex = 2;
//
// stStauts
//
this.stStauts.Icon = ((System.Drawing.Icon)(resources.GetObject("stStauts.Icon")));
this.stStauts.Text = "所有记录:";
this.stStauts.Width = 150;
//
// stUserOperator
//
this.stUserOperator.Icon = ((System.Drawing.Icon)(resources.GetObject("stUserOperator.Icon")));
this.stUserOperator.Text = "当前用户:";
this.stUserOperator.Width = 160;
//
// stDateText
//
this.stDateText.Icon = ((System.Drawing.Icon)(resources.GetObject("stDateText.Icon")));
this.stDateText.Text = "当前日期:";
this.stDateText.Width = 200;
//
// stTimeText
//
this.stTimeText.Icon = ((System.Drawing.Icon)(resources.GetObject("stTimeText.Icon")));
this.stTimeText.Text = "当前时间:";
this.stTimeText.Width = 200;
//
// stState
//
this.stState.Icon = ((System.Drawing.Icon)(resources.GetObject("stState.Icon")));
this.stState.Text = "状态:";
this.stState.Width = 150;
//
// dataGridSource
//
this.dataGridSource.AlternatingBackColor = System.Drawing.Color.GhostWhite;
this.dataGridSource.BackColor = System.Drawing.Color.GhostWhite;
this.dataGridSource.BackgroundColor = System.Drawing.Color.Lavender;
this.dataGridSource.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dataGridSource.CaptionBackColor = System.Drawing.Color.RoyalBlue;
this.dataGridSource.CaptionForeColor = System.Drawing.Color.White;
this.dataGridSource.CaptionVisible = false;
this.dataGridSource.DataMember = "";
this.dataGridSource.FlatMode = true;
this.dataGridSource.Font = new System.Drawing.Font("Tahoma", 8F);
this.dataGridSource.ForeColor = System.Drawing.Color.MidnightBlue;
this.dataGridSource.GridLineColor = System.Drawing.Color.RoyalBlue;
this.dataGridSource.HeaderBackColor = System.Drawing.Color.MidnightBlue;
this.dataGridSource.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGridSource.HeaderForeColor = System.Drawing.Color.Lavender;
this.dataGridSource.LinkColor = System.Drawing.Color.Teal;
this.dataGridSource.Location = new System.Drawing.Point(0, 80);
this.dataGridSource.Name = "dataGridSource";
this.dataGridSource.ParentRowsBackColor = System.Drawing.Color.Lavender;
this.dataGridSource.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
this.dataGridSource.ReadOnly = true;
this.dataGridSource.SelectionBackColor = System.Drawing.Color.Teal;
this.dataGridSource.SelectionForeColor = System.Drawing.Color.PaleGreen;
this.dataGridSource.Size = new System.Drawing.Size(864, 352);
this.dataGridSource.TabIndex = 3;
this.dataGridSource.CurrentCellChanged += new System.EventHandler(this.dataGridSource_CurrentCellChanged);
//
// currentTime
//
this.currentTime.Enabled = true;
this.currentTime.Interval = 1000;
this.currentTime.Tick += new System.EventHandler(this.currentTime_Tick);
//
// ParentFrame
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(862, 459);
this.Controls.Add(this.dataGridSource);
this.Controls.Add(this.status);
this.Controls.Add(this.TitleLabel);
this.Controls.Add(this.tool);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
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.stStauts)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.stUserOperator)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.stDateText)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.stTimeText)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.stState)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridSource)).EndInit();
this.ResumeLayout(false);
}
#endregion
#region 初始化事件...
private void ParentFrame_Load(object sender, System.EventArgs e)
{
try
{
#region 初始化状态栏上文本信息...
this.stDateText.Text="当前日期:"+System.DateTime.Now.ToLongDateString().Trim();
this.stState.Text="状态:无";
this.stUserOperator.Text="当前用户:"+landFrame.strUserName.ToString().Trim();
#endregion
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 工具栏事件...
private void tool_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
try
{
if(e.Button.ToolTipText.ToString().Equals("首记录"))
{
this.dataGridSource.UnSelect(this.cmOrders.Position);
this.cmOrders.Position=0;
this.dataGridSource.Select(this.cmOrders.Position);
this.dataGridSource.CurrentRowIndex=this.cmOrders.Position;
MessageBox.Show(this,"你已经到了记录开始了,无法继续向上移动了啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFrist.Enabled=false;
this.tLast.Enabled=false;
this.tNext.Enabled=true;
this.tEnd.Enabled=true;
return;
}
else if(e.Button.ToolTipText.ToString().Equals("尾记录"))
{
this.dataGridSource.UnSelect(this.cmOrders.Position);
this.cmOrders.Position=this.cmOrders.Count-1;
this.dataGridSource.Select(this.cmOrders.Position);
this.dataGridSource.CurrentRowIndex=this.cmOrders.Position;
MessageBox.Show(this,"你已经到了最后一条记录,无法继续向下移啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFrist.Enabled=true;
this.tLast.Enabled=true;
this.tNext.Enabled=false;
this.tEnd.Enabled=false;
return;
}
else if(e.Button.ToolTipText.ToString().Equals("下一条记录"))
{
if(this.cmOrders.Position.Equals(this.cmOrders.Count-1))
{
MessageBox.Show(this,"你已经到了最后一条记录,无法继续向下移啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFrist.Enabled=true;
this.tLast.Enabled=true;
this.tNext.Enabled=false;
this.tEnd.Enabled=false;
}
else if(this.cmOrders.Position<this.cmOrders.Count-1)
{
this.dataGridSource.UnSelect(this.cmOrders.Position);
this.cmOrders.Position++;
this.dataGridSource.Select(this.cmOrders.Position);
this.dataGridSource.CurrentRowIndex=this.cmOrders.Position;
}
return;
}
else if(e.Button.ToolTipText.ToString().Equals("上一条记录"))
{
if(this.cmOrders.Position==0)
{
MessageBox.Show(this,"你已经到了记录开始了,无法继续向上移动了啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFrist.Enabled=false;
this.tLast.Enabled=false;
this.tNext.Enabled=true;
this.tEnd.Enabled=true;
}
else if(this.cmOrders.Position>0)
{
this.dataGridSource.UnSelect(this.cmOrders.Position);
this.cmOrders.Position--;
this.dataGridSource.Select(this.cmOrders.Position);
this.dataGridSource.CurrentRowIndex=this.cmOrders.Position;
}
return;
}
else if(e.Button.ToolTipText.ToString().Equals("删除历史"))
{
this.ds.Clear();
ConnectionData conn=new ConnectionData();
int h=conn.ExcuteStrSql("delete from '"+tablename+"'");
dataAdapter.Update(ds);
if(h>0)
{}
else
{
MessageBox.Show(this,"删除历史失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
return;
}
else if(e.Button.ToolTipText.ToString().Equals("退出"))
{
DialogResult result=MessageBox.Show(this,"是否要关闭此窗体啦!!!","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
if(result.Equals(DialogResult.Yes))
{
Close();
}
else
{
return;
}
return;
}
else if(e.Button.ToolTipText.ToString().Equals("查询"))
{
MessageBox.Show(this,"右侧下拉列表啊!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
#region 初始化菜单...
if(UserDengLuFrame.blDengLu.Equals(true))
{
searchUserDengluHistory.Enabled=true;
searchUserZhuCheHistory.Enabled=false;
searchUserManagerHistory.Enabled=false;
UserDengLuFrame.blDengLu=false;
}
else if(userZhuCheHistoryFrame.blZhuChe.Equals(true))
{
searchUserZhuCheHistory.Enabled=true;
searchUserDengluHistory.Enabled=false;
searchUserManagerHistory.Enabled=false;
userZhuCheHistoryFrame.blZhuChe=false;
}
else if(userManagerHistoyrFrame.blManager.Equals(true))
{
searchUserManagerHistory.Enabled=true;
searchUserDengluHistory.Enabled=false;
searchUserZhuCheHistory.Enabled=false;
userManagerHistoyrFrame.blManager=false;
}
#endregion
}
else if(e.Button.ToolTipText.ToString().Equals("删除"))
{
if(this.ds.Tables[0].Rows.Count>0)
{
this.cmOrders.RemoveAt(this.cmOrders.Position);
dataAdapter.Update(ds);
}
else
{
return;
}
return;
}
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 初始化工具栏上时间信息...
private void currentTime_Tick(object sender, System.EventArgs e)
{
this.stTimeText.Text="当前时间:"+dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
}
#endregion
#region 查询历史操作...
private void searchUserDengluHistory_Click(object sender, System.EventArgs e)
{
searchuserdenluHistory log=new searchuserdenluHistory();
log.ShowDialog();
}
private void searchUserZhuCheHistory_Click(object sender, System.EventArgs e)
{
searchUserzhucheHistory loi=new searchUserzhucheHistory();
loi.ShowDialog();
}
private void searchUserManagerHistory_Click(object sender, System.EventArgs e)
{
searchUserManagerHistory login=new searchUserManagerHistory();
login.ShowDialog();
}
#endregion
#region 光标移动何地显示不同的值...
private void dataGridSource_CurrentCellChanged(object sender, System.EventArgs e)
{
this.stState.Text="编号:"+this.dataGridSource[this.dataGridSource.CurrentRowIndex,0].ToString().Trim();
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -