From d35bb711f8d3d267b44b4a80c20e31dabf309ae7 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期二, 14 一月 2025 08:17:18 +0800 Subject: [PATCH] 其它入库 --- DevApp/Gs.DevApp/UserControl/UcPageBar.cs | 131 ++++++++++++++++++------------------------- 1 files changed, 54 insertions(+), 77 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/UcPageBar.cs b/DevApp/Gs.DevApp/UserControl/UcPageBar.cs index 9b3b194..27932ad 100644 --- a/DevApp/Gs.DevApp/UserControl/UcPageBar.cs +++ b/DevApp/Gs.DevApp/UserControl/UcPageBar.cs @@ -1,77 +1,32 @@ -锘縰sing System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +锘縰sing Gs.DevApp.ToolBox; +using System; using System.Windows.Forms; -using DevExpress.XtraEditors; -using DevExpress.XtraGrid; -using Gs.DevApp.ToolBox; namespace UserControls.Data { public partial class UcPageBar : UserControl { - public delegate void GetPageDataEvents(int curPage, int pageSize);//瀹氫箟濮旀墭 - public event GetPageDataEvents PagerEvent;//瀹氫箟浜嬩欢 + public delegate void + GetPageDataEvents(int curPage, int pageSize); //瀹氫箟濮旀墭 public UcPageBar() { InitializeComponent(); - // UtilityHelper.SetFont(layoutControl1); + this.cbxRowCount.Text = "50"; + this.cbxRowCount.SelectedIndexChanged += new System.EventHandler(this.cbxRowCount_SelectedIndexChanged); } - #region 瀹氫箟灞炴�� - - - int _TotalPages; - /// <summary> - /// 鎬婚〉鏁� - /// </summary> - public int TotalPages - { - get { return _TotalPages; } - set - { - _TotalPages = value; - } - } - - /// <summary> - /// 褰撳墠椤� - /// </summary> - public int CurrentPage - { - get; set; - } - - /// <summary> - /// 姣忛〉鏉℃暟 - /// </summary> - public int RowsCount - { - get; set; - } - - /// <summary> - /// 鎬昏褰曟暟 - /// </summary> - public int RecordCount - { - get; set; - } - #endregion + public event GetPageDataEvents PagerEvent; //瀹氫箟浜嬩欢 //閫夋嫨姣忛〉鏄剧ず鏉℃暟 - private void cbxRowCount_SelectedIndexChanged(object sender, EventArgs e) + 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); } //鎵嬪姩杈撳叆鏄剧ず椤甸潰缂栧彿 @@ -79,19 +34,13 @@ { if (e.KeyCode == Keys.Enter) { - int page = Convert.ToInt32(tbxCurrentPage.Text); + var page = Convert.ToInt32(tbxCurrentPage.Text); if (page < 1) - { CurrentPage = 1; - } else if (page > TotalPages) - { CurrentPage = TotalPages; - } else - { CurrentPage = page; - } if (PagerEvent != null) BtnEvents(sender, e); } @@ -113,10 +62,7 @@ { if (CurrentPage == 1) return; - if (CurrentPage <= TotalPages) - { - CurrentPage -= 1; - } + if (CurrentPage <= TotalPages) CurrentPage -= 1; if (PagerEvent != null) BtnEvents(sender, e); } @@ -126,10 +72,7 @@ { if (CurrentPage == TotalPages) return; - if (CurrentPage < TotalPages) - { - CurrentPage += 1; - } + if (CurrentPage < TotalPages) CurrentPage += 1; if (PagerEvent != null) BtnEvents(sender, e); } @@ -146,16 +89,16 @@ private void BtnEvents(object sender, EventArgs e) { - //setTxt(); PagerEvent(CurrentPage, RowsCount); } public void setTxt() { tbxCurrentPage.Text = CurrentPage.ToString(); - lbTotalPages.Text = "鍏� " + TotalPages.ToString() + "椤�"; - lbTotalRows.Text = "鍏� " + RecordCount.ToString() + " 鏉¤褰�"; - this.cbxRowCount.Text = this.RowsCount.ToString(); + lbTotalPages.Text = "鍏� " + TotalPages + "椤�"; + lbTotalRows.Text = "鍏� " + RecordCount + " 鏉¤褰�"; + if (RowsCount > 0) + cbxRowCount.Text = RowsCount.ToString(); if (CurrentPage == 1) lbFirstPage.Enabled = false; else @@ -173,5 +116,39 @@ else lbNextPage.Enabled = true; } + + #region 瀹氫箟灞炴�� + + /// <summary> + /// 鎬婚〉鏁� + /// </summary> + public int TotalPages { get; set; } + + /// <summary> + /// 褰撳墠椤� + /// </summary> + public int CurrentPage { get; set; } + + /// <summary> + /// 姣忛〉鏉℃暟 + /// </summary> + public int RowsCount { get { return int.Parse(this.cbxRowCount.Text); } } + + + int _RecordCount; + /// <summary> + /// 鎬昏褰曟暟 + /// </summary> + public int RecordCount + { + get { return _RecordCount; } + set + { + _RecordCount = value; + setTxt(); + } + } + + #endregion } -} +} \ No newline at end of file -- Gitblit v1.9.3