private void Form1_Load(object sender, EventArgs e) { BoundTopClass_Borrow(DeptID); BoundTopClass_Query(DeptID); #region CustomDataGridView加载和事件绑定 dgvDestroy.Dock = DockStyle.Fill; this.panel3.Controls.Add(dgvDestroy); this.dgvDestroy.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvDestroy_CellFormatting); this.dgvDestroy.CurrentCellChanged += new System.EventHandler(this.dgvDestroy_CurrentCellChanged); #endregion #region 设置dgv导航按钮 ToolStripMenuItem tsmiFirst = new ToolStripMenuItem(); ToolStripMenuItem tsmiOn = new ToolStripMenuItem(); ToolStripMenuItem tsmiNext = new ToolStripMenuItem(); ToolStripMenuItem tsmiLast = new ToolStripMenuItem(); publicDgv.getNavigationNoNewRows(dgvDestroy, btnConStart, btnConLast, btnConNext, btnConEnd, tsmiFirst, tsmiOn, tsmiNext, tsmiLast, txtDgvIndex); #endregion BoundLimit(DeptID); getData(); dgvDestroy.Focus(); }
private void InitForm() { #region CustomDataGridView加载和事件绑定 dgvBorrow.ScrollBars = ScrollBars.Vertical; dgvBorrow.HScrollBarEx = this.hScrollBar1; dgvBorrow.Dock = DockStyle.Fill; this.pnlDgv.Controls.Add(dgvBorrow); this.dgvBorrow.CurrentCellChanged += new System.EventHandler(this.dgvBorrow_CurrentCellChanged); this.dgvBorrow.CellFormatting += new DataGridViewCellFormattingEventHandler(dgvBorrow_CellFormatting); #endregion #region 设置dgv导航按钮 publicDgv.getNavigationNoNewRows(dgvBorrow, btnConStart, btnConLast, btnConNext, btnConEnd, tsm首记录, tsm上一记录, tsm下一记录, tsm尾记录, txtDgvIndex); #endregion dtpBorrowTimeStart.Value = Convert.ToDateTime(DateTime.Now.ToShortDateString()); dtpBorrowTimeEnd.Value = Convert.ToDateTime(DateTime.Now.ToShortDateString()); dtpReturnTimeStart.Value = Convert.ToDateTime(DateTime.Now.ToShortDateString()); dtpReturnTimeEnd.Value = Convert.ToDateTime(DateTime.Now.ToShortDateString()); BorrowForm = this; setPanelVisible(true); #region 时间控件的样式设置 dtpBorrowTimeStart.CalendarTitleBackColor = Color.SteelBlue; dtpBorrowTimeEnd.CalendarTitleBackColor = Color.SteelBlue; dtpReturnTimeStart.CalendarTitleBackColor = Color.SteelBlue; dtpReturnTimeEnd.CalendarTitleBackColor = Color.SteelBlue; #endregion //this.Text = dept.getDeptName(DeptID) + "——档案借阅"; cmbState.Items.Add("所有"); cmbState.Items.Add("借出"); cmbState.Items.Add("归还"); getData(); dgvBorrow.Focus(); }
private void Form1_Load(object sender, EventArgs e) { dgvDestroy.Focus(); }