From dbafcedefd3840d48b978de50141a15cffcc1e09 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 25 十月 2024 09:59:33 +0800 Subject: [PATCH] Merge branch 'master' of http://43.142.96.171:8080/r/~tjx/GsMesClient --- DevApp/Gs.DevApp/UserControl/UcPageBar.cs | 110 ++++++++++++++++++------------------------------------ 1 files changed, 37 insertions(+), 73 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/UcPageBar.cs b/DevApp/Gs.DevApp/UserControl/UcPageBar.cs index 9b3b194..bec80ee 100644 --- a/DevApp/Gs.DevApp/UserControl/UcPageBar.cs +++ b/DevApp/Gs.DevApp/UserControl/UcPageBar.cs @@ -1,72 +1,24 @@ 锘縰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; 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); + // UtilityHelper.SetFont(layoutControl1); } - #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); CurrentPage = 1; @@ -79,19 +31,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 +59,7 @@ { if (CurrentPage == 1) return; - if (CurrentPage <= TotalPages) - { - CurrentPage -= 1; - } + if (CurrentPage <= TotalPages) CurrentPage -= 1; if (PagerEvent != null) BtnEvents(sender, e); } @@ -126,10 +69,7 @@ { if (CurrentPage == TotalPages) return; - if (CurrentPage < TotalPages) - { - CurrentPage += 1; - } + if (CurrentPage < TotalPages) CurrentPage += 1; if (PagerEvent != null) BtnEvents(sender, e); } @@ -153,9 +93,9 @@ 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 + " 鏉¤褰�"; + cbxRowCount.Text = RowsCount.ToString(); if (CurrentPage == 1) lbFirstPage.Enabled = false; else @@ -173,5 +113,29 @@ 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; set; } + + /// <summary> + /// 鎬昏褰曟暟 + /// </summary> + public int RecordCount { get; set; } + + #endregion } -} +} \ No newline at end of file -- Gitblit v1.9.3