Commit 5a4fe92a HZH

修改分页控件算法

1 个父辈 eeada1a9
......@@ -31,16 +31,18 @@
this.btnFirst = new HZH_Controls.Controls.UCBtnExt();
this.btnPrevious = new HZH_Controls.Controls.UCBtnExt();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.p9 = new HZH_Controls.Controls.UCBtnExt();
this.p1 = new HZH_Controls.Controls.UCBtnExt();
this.btnToPage = new HZH_Controls.Controls.UCBtnExt();
this.btnEnd = new HZH_Controls.Controls.UCBtnExt();
this.btnNext = new HZH_Controls.Controls.UCBtnExt();
this.p8 = new HZH_Controls.Controls.UCBtnExt();
this.p7 = new HZH_Controls.Controls.UCBtnExt();
this.p6 = new HZH_Controls.Controls.UCBtnExt();
this.p5 = new HZH_Controls.Controls.UCBtnExt();
this.p4 = new HZH_Controls.Controls.UCBtnExt();
this.p3 = new HZH_Controls.Controls.UCBtnExt();
this.p2 = new HZH_Controls.Controls.UCBtnExt();
this.p1 = new HZH_Controls.Controls.UCBtnExt();
this.txtPage = new HZH_Controls.Controls.UCTextBoxEx();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
......@@ -49,9 +51,9 @@
//
this.btnFirst.BackColor = System.Drawing.Color.White;
this.btnFirst.BtnBackColor = System.Drawing.Color.White;
this.btnFirst.BtnFont = new System.Drawing.Font("微软雅黑", 11F);
this.btnFirst.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.btnFirst.BtnForeColor = System.Drawing.Color.Gray;
this.btnFirst.BtnText = "首页";
this.btnFirst.BtnText = "<<";
this.btnFirst.ConerRadius = 5;
this.btnFirst.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnFirst.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -65,7 +67,7 @@
this.btnFirst.Name = "btnFirst";
this.btnFirst.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.btnFirst.RectWidth = 1;
this.btnFirst.Size = new System.Drawing.Size(60, 30);
this.btnFirst.Size = new System.Drawing.Size(30, 30);
this.btnFirst.TabIndex = 0;
this.btnFirst.TabStop = false;
this.btnFirst.TipsText = "";
......@@ -75,9 +77,9 @@
//
this.btnPrevious.BackColor = System.Drawing.Color.White;
this.btnPrevious.BtnBackColor = System.Drawing.Color.White;
this.btnPrevious.BtnFont = new System.Drawing.Font("微软雅黑", 11F);
this.btnPrevious.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.btnPrevious.BtnForeColor = System.Drawing.Color.Gray;
this.btnPrevious.BtnText = "上一页";
this.btnPrevious.BtnText = "<";
this.btnPrevious.ConerRadius = 5;
this.btnPrevious.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnPrevious.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -86,12 +88,12 @@
this.btnPrevious.IsRadius = true;
this.btnPrevious.IsShowRect = true;
this.btnPrevious.IsShowTips = false;
this.btnPrevious.Location = new System.Drawing.Point(75, 5);
this.btnPrevious.Location = new System.Drawing.Point(45, 5);
this.btnPrevious.Margin = new System.Windows.Forms.Padding(5);
this.btnPrevious.Name = "btnPrevious";
this.btnPrevious.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.btnPrevious.RectWidth = 1;
this.btnPrevious.Size = new System.Drawing.Size(60, 30);
this.btnPrevious.Size = new System.Drawing.Size(30, 30);
this.btnPrevious.TabIndex = 1;
this.btnPrevious.TabStop = false;
this.btnPrevious.TipsText = "";
......@@ -100,9 +102,13 @@
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
this.tableLayoutPanel1.ColumnCount = 13;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnCount = 15;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
......@@ -112,29 +118,80 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Controls.Add(this.btnToPage, 12, 0);
this.tableLayoutPanel1.Controls.Add(this.btnEnd, 10, 0);
this.tableLayoutPanel1.Controls.Add(this.btnNext, 9, 0);
this.tableLayoutPanel1.Controls.Add(this.p9, 10, 0);
this.tableLayoutPanel1.Controls.Add(this.p1, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.btnToPage, 14, 0);
this.tableLayoutPanel1.Controls.Add(this.btnEnd, 12, 0);
this.tableLayoutPanel1.Controls.Add(this.btnNext, 11, 0);
this.tableLayoutPanel1.Controls.Add(this.p8, 9, 0);
this.tableLayoutPanel1.Controls.Add(this.p7, 8, 0);
this.tableLayoutPanel1.Controls.Add(this.p6, 7, 0);
this.tableLayoutPanel1.Controls.Add(this.p5, 6, 0);
this.tableLayoutPanel1.Controls.Add(this.p4, 5, 0);
this.tableLayoutPanel1.Controls.Add(this.p3, 4, 0);
this.tableLayoutPanel1.Controls.Add(this.p2, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.p1, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.btnPrevious, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.btnFirst, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.txtPage, 11, 0);
this.tableLayoutPanel1.Controls.Add(this.txtPage, 13, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(110, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(700, 40);
this.tableLayoutPanel1.Size = new System.Drawing.Size(662, 40);
this.tableLayoutPanel1.TabIndex = 1;
//
// p9
//
this.p9.BackColor = System.Drawing.Color.White;
this.p9.BtnBackColor = System.Drawing.Color.White;
this.p9.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p9.BtnForeColor = System.Drawing.Color.Gray;
this.p9.BtnText = "9";
this.p9.ConerRadius = 5;
this.p9.Cursor = System.Windows.Forms.Cursors.Hand;
this.p9.Dock = System.Windows.Forms.DockStyle.Fill;
this.p9.FillColor = System.Drawing.Color.White;
this.p9.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p9.IsRadius = true;
this.p9.IsShowRect = true;
this.p9.IsShowTips = false;
this.p9.Location = new System.Drawing.Point(402, 5);
this.p9.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p9.Name = "p9";
this.p9.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p9.RectWidth = 1;
this.p9.Size = new System.Drawing.Size(36, 30);
this.p9.TabIndex = 17;
this.p9.TabStop = false;
this.p9.TipsText = "";
this.p9.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// p1
//
this.p1.BackColor = System.Drawing.Color.White;
this.p1.BtnBackColor = System.Drawing.Color.White;
this.p1.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p1.BtnForeColor = System.Drawing.Color.Gray;
this.p1.BtnText = "1";
this.p1.ConerRadius = 5;
this.p1.Cursor = System.Windows.Forms.Cursors.Hand;
this.p1.Dock = System.Windows.Forms.DockStyle.Fill;
this.p1.FillColor = System.Drawing.Color.White;
this.p1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p1.IsRadius = true;
this.p1.IsShowRect = true;
this.p1.IsShowTips = false;
this.p1.Location = new System.Drawing.Point(82, 5);
this.p1.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p1.Name = "p1";
this.p1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p1.RectWidth = 1;
this.p1.Size = new System.Drawing.Size(36, 30);
this.p1.TabIndex = 16;
this.p1.TabStop = false;
this.p1.TipsText = "";
this.p1.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// btnToPage
//
this.btnToPage.BackColor = System.Drawing.Color.White;
......@@ -150,12 +207,12 @@
this.btnToPage.IsRadius = true;
this.btnToPage.IsShowRect = true;
this.btnToPage.IsShowTips = false;
this.btnToPage.Location = new System.Drawing.Point(635, 5);
this.btnToPage.Location = new System.Drawing.Point(595, 5);
this.btnToPage.Margin = new System.Windows.Forms.Padding(5);
this.btnToPage.Name = "btnToPage";
this.btnToPage.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.btnToPage.RectWidth = 1;
this.btnToPage.Size = new System.Drawing.Size(60, 30);
this.btnToPage.Size = new System.Drawing.Size(62, 30);
this.btnToPage.TabIndex = 15;
this.btnToPage.TabStop = false;
this.btnToPage.TipsText = "";
......@@ -165,9 +222,9 @@
//
this.btnEnd.BackColor = System.Drawing.Color.White;
this.btnEnd.BtnBackColor = System.Drawing.Color.White;
this.btnEnd.BtnFont = new System.Drawing.Font("微软雅黑", 11F);
this.btnEnd.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.btnEnd.BtnForeColor = System.Drawing.Color.Gray;
this.btnEnd.BtnText = "尾页";
this.btnEnd.BtnText = ">>";
this.btnEnd.ConerRadius = 5;
this.btnEnd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnEnd.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -176,12 +233,12 @@
this.btnEnd.IsRadius = true;
this.btnEnd.IsShowRect = true;
this.btnEnd.IsShowTips = false;
this.btnEnd.Location = new System.Drawing.Point(495, 5);
this.btnEnd.Location = new System.Drawing.Point(485, 5);
this.btnEnd.Margin = new System.Windows.Forms.Padding(5);
this.btnEnd.Name = "btnEnd";
this.btnEnd.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.btnEnd.RectWidth = 1;
this.btnEnd.Size = new System.Drawing.Size(60, 30);
this.btnEnd.Size = new System.Drawing.Size(30, 30);
this.btnEnd.TabIndex = 13;
this.btnEnd.TabStop = false;
this.btnEnd.TipsText = "";
......@@ -191,9 +248,9 @@
//
this.btnNext.BackColor = System.Drawing.Color.White;
this.btnNext.BtnBackColor = System.Drawing.Color.White;
this.btnNext.BtnFont = new System.Drawing.Font("微软雅黑", 11F);
this.btnNext.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.btnNext.BtnForeColor = System.Drawing.Color.Gray;
this.btnNext.BtnText = "下一页";
this.btnNext.BtnText = ">";
this.btnNext.ConerRadius = 5;
this.btnNext.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnNext.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -202,17 +259,43 @@
this.btnNext.IsRadius = true;
this.btnNext.IsShowRect = true;
this.btnNext.IsShowTips = false;
this.btnNext.Location = new System.Drawing.Point(425, 5);
this.btnNext.Location = new System.Drawing.Point(445, 5);
this.btnNext.Margin = new System.Windows.Forms.Padding(5);
this.btnNext.Name = "btnNext";
this.btnNext.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.btnNext.RectWidth = 1;
this.btnNext.Size = new System.Drawing.Size(60, 30);
this.btnNext.Size = new System.Drawing.Size(30, 30);
this.btnNext.TabIndex = 12;
this.btnNext.TabStop = false;
this.btnNext.TipsText = "";
this.btnNext.BtnClick += new System.EventHandler(this.btnNext_BtnClick);
//
// p8
//
this.p8.BackColor = System.Drawing.Color.White;
this.p8.BtnBackColor = System.Drawing.Color.White;
this.p8.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p8.BtnForeColor = System.Drawing.Color.Gray;
this.p8.BtnText = "8";
this.p8.ConerRadius = 5;
this.p8.Cursor = System.Windows.Forms.Cursors.Hand;
this.p8.Dock = System.Windows.Forms.DockStyle.Fill;
this.p8.FillColor = System.Drawing.Color.White;
this.p8.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p8.IsRadius = true;
this.p8.IsShowRect = true;
this.p8.IsShowTips = false;
this.p8.Location = new System.Drawing.Point(362, 5);
this.p8.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p8.Name = "p8";
this.p8.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p8.RectWidth = 1;
this.p8.Size = new System.Drawing.Size(36, 30);
this.p8.TabIndex = 8;
this.p8.TabStop = false;
this.p8.TipsText = "";
this.p8.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// p7
//
this.p7.BackColor = System.Drawing.Color.White;
......@@ -228,13 +311,13 @@
this.p7.IsRadius = true;
this.p7.IsShowRect = true;
this.p7.IsShowTips = false;
this.p7.Location = new System.Drawing.Point(382, 5);
this.p7.Location = new System.Drawing.Point(322, 5);
this.p7.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p7.Name = "p7";
this.p7.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p7.RectWidth = 1;
this.p7.Size = new System.Drawing.Size(36, 30);
this.p7.TabIndex = 8;
this.p7.TabIndex = 7;
this.p7.TabStop = false;
this.p7.TipsText = "";
this.p7.BtnClick += new System.EventHandler(this.page_BtnClick);
......@@ -254,13 +337,13 @@
this.p6.IsRadius = true;
this.p6.IsShowRect = true;
this.p6.IsShowTips = false;
this.p6.Location = new System.Drawing.Point(342, 5);
this.p6.Location = new System.Drawing.Point(282, 5);
this.p6.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p6.Name = "p6";
this.p6.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p6.RectWidth = 1;
this.p6.Size = new System.Drawing.Size(36, 30);
this.p6.TabIndex = 7;
this.p6.TabIndex = 6;
this.p6.TabStop = false;
this.p6.TipsText = "";
this.p6.BtnClick += new System.EventHandler(this.page_BtnClick);
......@@ -280,13 +363,13 @@
this.p5.IsRadius = true;
this.p5.IsShowRect = true;
this.p5.IsShowTips = false;
this.p5.Location = new System.Drawing.Point(302, 5);
this.p5.Location = new System.Drawing.Point(242, 5);
this.p5.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p5.Name = "p5";
this.p5.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p5.RectWidth = 1;
this.p5.Size = new System.Drawing.Size(36, 30);
this.p5.TabIndex = 6;
this.p5.TabIndex = 5;
this.p5.TabStop = false;
this.p5.TipsText = "";
this.p5.BtnClick += new System.EventHandler(this.page_BtnClick);
......@@ -306,13 +389,13 @@
this.p4.IsRadius = true;
this.p4.IsShowRect = true;
this.p4.IsShowTips = false;
this.p4.Location = new System.Drawing.Point(262, 5);
this.p4.Location = new System.Drawing.Point(202, 5);
this.p4.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p4.Name = "p4";
this.p4.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p4.RectWidth = 1;
this.p4.Size = new System.Drawing.Size(36, 30);
this.p4.TabIndex = 5;
this.p4.TabIndex = 4;
this.p4.TabStop = false;
this.p4.TipsText = "";
this.p4.BtnClick += new System.EventHandler(this.page_BtnClick);
......@@ -332,13 +415,13 @@
this.p3.IsRadius = true;
this.p3.IsShowRect = true;
this.p3.IsShowTips = false;
this.p3.Location = new System.Drawing.Point(222, 5);
this.p3.Location = new System.Drawing.Point(162, 5);
this.p3.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p3.Name = "p3";
this.p3.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p3.RectWidth = 1;
this.p3.Size = new System.Drawing.Size(36, 30);
this.p3.TabIndex = 4;
this.p3.TabIndex = 3;
this.p3.TabStop = false;
this.p3.TipsText = "";
this.p3.BtnClick += new System.EventHandler(this.page_BtnClick);
......@@ -358,43 +441,17 @@
this.p2.IsRadius = true;
this.p2.IsShowRect = true;
this.p2.IsShowTips = false;
this.p2.Location = new System.Drawing.Point(182, 5);
this.p2.Location = new System.Drawing.Point(122, 5);
this.p2.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p2.Name = "p2";
this.p2.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p2.RectWidth = 1;
this.p2.Size = new System.Drawing.Size(36, 30);
this.p2.TabIndex = 3;
this.p2.TabIndex = 2;
this.p2.TabStop = false;
this.p2.TipsText = "";
this.p2.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// p1
//
this.p1.BackColor = System.Drawing.Color.White;
this.p1.BtnBackColor = System.Drawing.Color.White;
this.p1.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p1.BtnForeColor = System.Drawing.Color.Gray;
this.p1.BtnText = "1";
this.p1.ConerRadius = 5;
this.p1.Cursor = System.Windows.Forms.Cursors.Hand;
this.p1.Dock = System.Windows.Forms.DockStyle.Fill;
this.p1.FillColor = System.Drawing.Color.White;
this.p1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p1.IsRadius = true;
this.p1.IsShowRect = true;
this.p1.IsShowTips = false;
this.p1.Location = new System.Drawing.Point(142, 5);
this.p1.Margin = new System.Windows.Forms.Padding(2, 5, 2, 5);
this.p1.Name = "p1";
this.p1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(223)))), ((int)(((byte)(223)))));
this.p1.RectWidth = 1;
this.p1.Size = new System.Drawing.Size(36, 30);
this.p1.TabIndex = 2;
this.p1.TabStop = false;
this.p1.TipsText = "";
this.p1.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// txtPage
//
this.txtPage.BackColor = System.Drawing.Color.Transparent;
......@@ -413,7 +470,7 @@
this.txtPage.IsShowRect = true;
this.txtPage.IsShowSearchBtn = false;
this.txtPage.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN;
this.txtPage.Location = new System.Drawing.Point(564, 5);
this.txtPage.Location = new System.Drawing.Point(524, 5);
this.txtPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtPage.MaxValue = new decimal(new int[] {
1000000,
......@@ -455,14 +512,16 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private UCBtnExt btnEnd;
private UCBtnExt btnNext;
private UCBtnExt p8;
private UCBtnExt p7;
private UCBtnExt p6;
private UCBtnExt p5;
private UCBtnExt p4;
private UCBtnExt p3;
private UCBtnExt p2;
private UCBtnExt p1;
private UCBtnExt btnToPage;
private UCTextBoxEx txtPage;
private UCBtnExt p9;
private UCBtnExt p1;
}
}
......@@ -65,6 +65,8 @@ namespace HZH_Controls.Controls.List
public override void FirstPage()
{
if (PageIndex == 1)
return;
PageIndex = 1;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
......@@ -77,7 +79,12 @@ namespace HZH_Controls.Controls.List
public override void PreviousPage()
{
if (PageIndex <= 1)
{
return;
}
PageIndex--;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
......@@ -89,6 +96,10 @@ namespace HZH_Controls.Controls.List
public override void NextPage()
{
if (PageIndex >= PageCount)
{
return;
}
PageIndex++;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
......@@ -101,6 +112,8 @@ namespace HZH_Controls.Controls.List
public override void EndPage()
{
if (PageIndex == PageCount)
return;
PageIndex = PageCount;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
......@@ -128,35 +141,66 @@ namespace HZH_Controls.Controls.List
{
ControlHelper.FreezeControl(tableLayoutPanel1, true);
List<int> lst = new List<int>();
if (PageCount > 0)
if (PageCount <= 9)
{
if (PageCount <= 7)
for (var i = 1; i <= PageCount; i++)
{
for (int i = 0; i < PageCount; i++)
lst.Add(i);
}
}
else
{
if (this.PageIndex <= 6)
{
lst.Add(i + 1);
for (var i = 1; i <= 7; i++)
{
lst.Add(i);
}
lst.Add(-1);
lst.Add(PageCount);
}
else if (this.PageIndex > PageCount - 6)
{
lst.Add(1);
lst.Add(-1);
for (var i = PageCount - 6; i <= PageCount; i++)
{
lst.Add(i);
}
}
else
{
int start = PageIndex; //开始按钮数字
int end = 1; //结束按钮数字
int pageCount = PageCount; //总页数
int offset = 3; //偏移量
start -= offset;//计算左偏移量
start = start < 1 ? 1 : start;//限定最小页码
end = start + 7 - 1;//根据偏移计算结束按钮
end = end > pageCount ? pageCount : end;//限定最大页码
start = end - 7 + 1;//根据偏移计算开始页码
start = start < 1 ? 1 : start;//限定最小页码
for (int i = start; i <= end; i++)
lst.Add(1);
lst.Add(-1);
var begin = PageIndex - 2;
var end = PageIndex + 2;
if (end > PageCount)
{
end = PageCount;
begin = end - 4;
if (PageIndex - begin < 2)
{
begin = begin - 1;
}
}
else if (end + 1 == PageCount)
{
end = PageCount;
}
for (var i = begin; i <= end; i++)
{
lst.Add(i);
}
if (end != PageCount)
{
lst.Add(-1);
lst.Add(PageCount);
}
}
}
for (int i = 0; i < 7; i++)
for (int i = 0; i < 9; i++)
{
UCBtnExt c = (UCBtnExt)this.tableLayoutPanel1.Controls.Find("p" + (i + 1), false)[0];
if (i >= lst.Count)
......@@ -165,7 +209,16 @@ namespace HZH_Controls.Controls.List
}
else
{
if (lst[i] == -1)
{
c.BtnText = "...";
c.Enabled = false;
}
else
{
c.BtnText = lst[i].ToString();
c.Enabled = true;
}
c.Visible = true;
if (lst[i] == PageIndex)
{
......
......@@ -92,7 +92,7 @@ namespace Test
List<object> lstPage2 = new List<object>();
for (int i = 0; i < 1000; i++)
for (int i = 0; i < 100; i++)
{
lstPage2.Add(i);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!