⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kahaohistoryframe.cs

📁 独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.dataGrid.AlternatingBackColor = System.Drawing.Color.White;
			this.dataGrid.BackColor = System.Drawing.Color.White;
			this.dataGrid.BackgroundColor = System.Drawing.Color.Gainsboro;
			this.dataGrid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.dataGrid.CaptionBackColor = System.Drawing.Color.Silver;
			this.dataGrid.CaptionFont = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Bold);
			this.dataGrid.CaptionForeColor = System.Drawing.Color.Black;
			this.dataGrid.CaptionVisible = false;
			this.dataGrid.DataMember = "";
			this.dataGrid.FlatMode = true;
			this.dataGrid.Font = new System.Drawing.Font("Courier New", 9F);
			this.dataGrid.ForeColor = System.Drawing.Color.DarkSlateGray;
			this.dataGrid.GridLineColor = System.Drawing.Color.DarkGray;
			this.dataGrid.HeaderBackColor = System.Drawing.Color.DarkGreen;
			this.dataGrid.HeaderFont = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Bold);
			this.dataGrid.HeaderForeColor = System.Drawing.Color.White;
			this.dataGrid.LinkColor = System.Drawing.Color.DarkGreen;
			this.dataGrid.Location = new System.Drawing.Point(0, 48);
			this.dataGrid.Name = "dataGrid";
			this.dataGrid.ParentRowsBackColor = System.Drawing.Color.Gainsboro;
			this.dataGrid.ParentRowsForeColor = System.Drawing.Color.Black;
			this.dataGrid.SelectionBackColor = System.Drawing.Color.DarkSeaGreen;
			this.dataGrid.SelectionForeColor = System.Drawing.Color.Black;
			this.dataGrid.Size = new System.Drawing.Size(776, 344);
			this.dataGrid.TabIndex = 2;
			// 
			// currentTimer
			// 
			this.currentTimer.Enabled = true;
			this.currentTimer.Interval = 1000;
			this.currentTimer.Tick += new System.EventHandler(this.currentTimer_Tick);
			// 
			// KaHaoHistoryFrame
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(770, 423);
			this.Controls.Add(this.dataGrid);
			this.Controls.Add(this.KaHaoStatus);
			this.Controls.Add(this.KaHaoTool);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "KaHaoHistoryFrame";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "KaHaoHistoryFrame";
			this.Load += new System.EventHandler(this.KaHaoHistoryFrame_Load);
			((System.ComponentModel.ISupportInitialize)(this.stID)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.stTime)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.stDate)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.stOperator)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.stStatus)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
		#region 事件初始化...
		private void KaHaoHistoryFrame_Load(object sender, System.EventArgs e)
		{
			try
			{
				#region 状态栏上信息初始化...
				this.stOperator.Text="操作员:"+landFrame.strName;
				this.stStatus.Text="状态:无";
				#endregion
				#region  绑定DataGrid表格上...
                searchSql="select * from KaHao_History";
                DataTable tempTable=new DataTable();
				tempTable=this.ExcuteStrSql(searchSql,"KaHao_History");
				this.dataGrid.DataSource=tempTable;
				this.cmOrder=(System.Windows.Forms.CurrencyManager)BindingContext[tempTable];
				BindingsContext(tempTable);
				#endregion
			}
			catch(Exception ele)
			{
				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
		}
		#endregion
		#region 绑定函数
		private void BindingsContext(DataTable tableName)
		{
			//this.KaHaoStatus.DataBindings.Add("Text",tableName,"编号");
			for(int i=this.dataGrid.CurrentCell.RowNumber;i<tableName.Rows.Count;i++)
			{
			    this.stID.Text="最大号:"+tableName.Rows[i][0].ToString().Trim();
				this.stStatus.Text="状态:"+tableName.Rows[i][5].ToString().Trim();
			}
			//this.stStatus.Text="状态:"+this.dataGrid[this.dataGrid.CurrentCell.RowNumber,5].ToString().Trim();
		}
		#endregion
		#region 工具栏上单击事件.......
		private void KaHaoTool_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			switch(KaHaoTool.Buttons.IndexOf(e.Button))
			{
				case 1://上一条记录
				{
					if(this.cmOrder.Position.Equals(0))
					{
						MessageBox.Show(this,"已经到了首记录啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
						this.toolLast.Enabled=false;
						this.toolFirst.Enabled=false;
						this.toolNext.Enabled=true;
						this.toolEnd.Enabled=true;
					}
					else if(this.cmOrder.Position>0)
					{
						this.dataGrid.UnSelect(this.cmOrder.Position);
						this.cmOrder.Position--;
						this.dataGrid.Select(this.cmOrder.Position);
						this.dataGrid.CurrentRowIndex=this.cmOrder.Position;
					}
                    break;
				}
				case 0://首记录
				{
					this.dataGrid.UnSelect(this.cmOrder.Position);
					this.cmOrder.Position=0;
					this.dataGrid.Select(this.cmOrder.Position);
					this.dataGrid.CurrentRowIndex=this.cmOrder.Position;
					MessageBox.Show(this,"已经到了首记录啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					this.toolLast.Enabled=false;
					this.toolFirst.Enabled=false;
					this.toolEnd.Enabled=true;
					this.toolNext.Enabled=true;
                    break;
				}
				case 2://下一条记录
				{
					if(this.cmOrder.Position.Equals(this.cmOrder.Count-1))
					{
						MessageBox.Show(this,"你已经到了最后一条记录啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
						this.toolFirst.Enabled=true;
						this.toolLast.Enabled=true;
						this.toolEnd.Enabled=false;
						this.toolNext.Enabled=false;
					}
					else if(this.cmOrder.Position<this.cmOrder.Count-1)
					{
						this.dataGrid.UnSelect(this.cmOrder.Position);
						this.cmOrder.Position++;
						this.dataGrid.Select(this.cmOrder.Position);
						this.dataGrid.CurrentRowIndex=this.cmOrder.Position;
					}
                    break;
				}
				case 3://尾记录
				{
					this.dataGrid.UnSelect(this.cmOrder.Position);
					this.cmOrder.Position=this.cmOrder.Count-1;
					this.dataGrid.Select(this.cmOrder.Position);
					this.dataGrid.CurrentRowIndex=this.cmOrder.Position;
					MessageBox.Show(this,"已经到了最后一条记录啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
					this.toolFirst.Enabled=true;
					this.toolLast.Enabled=true;
					this.toolEnd.Enabled=false;
					this.toolNext.Enabled=false;
                    break;
				}
				case 4://查询
				{
                      KaHaoSearchFrame log=new KaHaoSearchFrame();
					  log.ShowDialog();
					  break;
				}
				case 5://刷新
				{
                     break;
				}
				case 6://删除
				{
                    break;
				}
				case 7://退出
				{
                    DialogResult result=MessageBox.Show(this,"是否关闭窗体!!!","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
					if(result.Equals(DialogResult.Yes))
					{
						Close();
					}
					else
					{
						return;
					}
					break;
				}
			}
		}
		#endregion
		#region 处理时间事件...
		private void currentTimer_Tick(object sender, System.EventArgs e)
		{
			#region 状态栏上时间与日期初始化...
			this.stDate.Text="日期:"+System.DateTime.Now.ToLongDateString().Trim();
			this.stTime.Text="时间:"+System.DateTime.Now.ToLongTimeString().Trim();
			#endregion
		}
		#endregion
		#region 数据库处理函数
		private DataTable ExcuteStrSql(string strSql,string tableName)
		{
			DataTable temptable=new DataTable();
			DataSet tempSet=new DataSet();
			try
			{
                tempSet=conn.ExcuteDataSetResult(strSql,tableName);
				temptable=tempSet.Tables[0];
			}
			catch(Exception ele)
			{
				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			return temptable;
		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -