| | |
| | | using System; |
| | | using Gs.DevApp.ToolBox; |
| | | using System; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace UserControls.Data |
| | |
| | | public UcPageBar() |
| | | { |
| | | InitializeComponent(); |
| | | // UtilityHelper.SetFont(layoutControl1); |
| | | this.cbxRowCount.Text = "50"; |
| | | this.cbxRowCount.SelectedIndexChanged += new System.EventHandler(this.cbxRowCount_SelectedIndexChanged); |
| | | } |
| | | |
| | | public event GetPageDataEvents PagerEvent; //定义事件 |
| | |
| | | private void cbxRowCount_SelectedIndexChanged(object sender, |
| | | EventArgs e) |
| | | { |
| | | RowsCount = Convert.ToInt32(cbxRowCount.Text); |
| | | int _RowsCount = Convert.ToInt32(cbxRowCount.Text); |
| | | CurrentPage = 1; |
| | | if (PagerEvent != null) |
| | | BtnEvents(sender, e); |
| | | if (_RowsCount > 0 && _RowsCount > 0) |
| | | BtnEvents(sender, e); |
| | | } |
| | | |
| | | //手动输入显示页面编号 |
| | |
| | | |
| | | private void BtnEvents(object sender, EventArgs e) |
| | | { |
| | | //setTxt(); |
| | | PagerEvent(CurrentPage, RowsCount); |
| | | } |
| | | |
| | |
| | | tbxCurrentPage.Text = CurrentPage.ToString(); |
| | | lbTotalPages.Text = "共 " + TotalPages + "页"; |
| | | lbTotalRows.Text = "共 " + RecordCount + " 条记录"; |
| | | cbxRowCount.Text = RowsCount.ToString(); |
| | | if (RowsCount > 0) |
| | | cbxRowCount.Text = RowsCount.ToString(); |
| | | if (CurrentPage == 1) |
| | | lbFirstPage.Enabled = false; |
| | | else |
| | |
| | | /// <summary> |
| | | /// 每页条数 |
| | | /// </summary> |
| | | public int RowsCount { get; set; } |
| | | public int RowsCount { get { return int.Parse(this.cbxRowCount.Text); } } |
| | | |
| | | |
| | | int _RecordCount; |
| | | /// <summary> |
| | | /// 总记录数 |
| | | /// </summary> |
| | | public int RecordCount { get; set; } |
| | | public int RecordCount |
| | | { |
| | | get { return _RecordCount; } |
| | | set |
| | | { |
| | | _RecordCount = value; |
| | | setTxt(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |