入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章。
GitHub:https://github.com/kwwwvagaa/NetWinformControl
码云:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
如果觉得写的还行,请点个 star 支持一下吧
欢迎前来交流探讨: 企鹅群568015492
https://blog.csdn.net/kwwwvagaa/article/details/100586547
当一个列表加载数据过多时,比如datagridview,如果数据过多,则可能超出内存,相应慢等问题,此时需要用到翻页控件。
设计思路,对翻页控件定义接口,基类实现,如果所列的翻页控件样式或功能无法满足你的需求的话,你只需要基类翻页控件基类或者实现接口即可。
定义接口是因为后面的一些列表控件内置了翻页控件,为了达到兼容扩展,所有使用了接口定义约束。
首先需要一个分页事件用到的委托,偷懒,只写了一个
[Serializable]
[ComVisible(true)]
public delegate void PageControlEventHandler(object currentSource);
我们先定义一个接口IPageControl
1 public interface IPageControl
2 {
3 ///
4 /// 数据源改变时发生
5 ///
6 event PageControlEventHandler ShowSourceChanged;
7 ///
8 /// 数据源
9 ///
10 List
然后定义一个分页基类控件,添加一个用户控件,命名UCPagerControlBase,并实现接口IPageControl
看下属性
1 ///
2 /// 总页数
3 ///
4 public virtual int PageCount
5 {
6 get;
7 set;
8 }
9 private int m_pageIndex = 1;
10 ///
11 /// 当前页码
12 ///
13 public virtual int PageIndex
14 {
15 get { return m_pageIndex; }
16 set { m_pageIndex = value; }
17 }
18 ///
19 /// 关联的数据源
20 ///
21 public virtual List DataSource { get; set; }
22 public virtual event PageControlEventHandler ShowSourceChanged;
23 private int m_pageSize = 1;
24 ///
25 /// 每页显示数量
26 ///
27 [Description("每页显示数量"), Category("自定义")]
28 public virtual int PageSize
29 {
30 get { return m_pageSize; }
31 set { m_pageSize = value; }
32 }
33 private int startIndex = 0;
34 ///
35 /// 开始的下标
36 ///
37 [Description("开始的下标"), Category("自定义")]
38 public virtual int StartIndex
39 {
40 get { return startIndex; }
41 set
42 {
43 startIndex = value;
44 if (startIndex <= 0)
45 startIndex = 0;
46 }
47 }
然后定义虚函数,并做一些默认实现
///
/// 第一页
///
public virtual void FirstPage()
{
if (DataSource == null)
return;
startIndex = 0;
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
///
/// 上一页
///
public virtual void PreviousPage()
{
if (DataSource == null)
return;
if (startIndex == 0)
return;
startIndex -= m_pageSize;
if (startIndex < 0)
startIndex = 0;
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
///
/// 下一页
///
public virtual void NextPage()
{
if (DataSource == null)
return;
if (startIndex + m_pageSize >= DataSource.Count)
{
return;
}
startIndex += m_pageSize;
if (startIndex < 0)
startIndex = 0;
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
///
/// 最后一页
///
public virtual void EndPage()
{
if (DataSource == null)
return;
startIndex = DataSource.Count - m_pageSize;
if (startIndex < 0)
startIndex = 0;
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
///
/// 刷新数据
///
public virtual void Reload()
{
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
///
/// 获取当前页数据
///
///
public virtual List GetCurrentSource()
{
if (DataSource == null)
return null;
int intShowCount = m_pageSize;
if (intShowCount + startIndex > DataSource.Count)
intShowCount = DataSource.Count - startIndex;
object[] objs = new object[intShowCount];
DataSource.CopyTo(startIndex, objs, 0, intShowCount);
var lst = objs.ToList();
bool blnLeft = false;
bool blnRight = false;
if (lst.Count > 0)
{
if (DataSource.IndexOf(lst[0]) > 0)
{
blnLeft = true;
}
else
{
blnLeft = false;
}
if (DataSource.IndexOf(lst[lst.Count - 1]) >= DataSource.Count - 1)
{
blnRight = false;
}
else
{
blnRight = true;
}
}
ShowBtn(blnLeft, blnRight);
return lst;
}
///
/// 控制按钮显示
///
/// 是否显示上一页,第一页
/// 是否显示下一页,最后一页
protected virtual void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
{ }
如此基类就完成了,看下完整代码
View Code
接下来就是具体的实现分页控件了,我们将实现2种不同样式的分页控件以适应不通的场景,
第一种
添加用户控件UCPagerControl,继承UCPagerControlBase
重新基类的部分函数
1 private void panel1_MouseDown(object sender, MouseEventArgs e)
2 {
3 PreviousPage();
4 }
5
6 private void panel2_MouseDown(object sender, MouseEventArgs e)
7 {
8 NextPage();
9 }
10
11 private void panel3_MouseDown(object sender, MouseEventArgs e)
12 {
13 FirstPage();
14 }
15
16 private void panel4_MouseDown(object sender, MouseEventArgs e)
17 {
18 EndPage();
19 }
20
21 protected override void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
22 {
23 panel1.Visible = panel3.Visible = blnLeftBtn;
24 panel2.Visible = panel4.Visible = blnRightBtn;
25 }
完成,是不是很简单,看下全部代码
View Code
View Code
第二种
这种和第一种的唯一区别就是页面计算生成的部分了
添加一个用户控件UCPagerControl2,继承UCPagerControlBase
属性如下
1 public override event PageControlEventHandler ShowSourceChanged;
2
3 private List m_dataSource;
4 public override List DataSource
5 {
6 get
7 {
8 return m_dataSource;
9 }
10 set
11 {
12 m_dataSource = value;
13 if (m_dataSource == null)
14 m_dataSource = new List();
15 ResetPageCount();
16 }
17 }
18 private int m_intPageSize = 0;
19 public override int PageSize
20 {
21 get
22 {
23 return m_intPageSize;
24 }
25 set
26 {
27 m_intPageSize = value;
28 ResetPageCount();
29 }
30 }
其他更多的属性直接用基类的就可以
重写基类函数
1 public override void FirstPage()
2 {
3 if (PageIndex == 1)
4 return;
5 PageIndex = 1;
6 StartIndex = (PageIndex - 1) * PageSize;
7 ReloadPage();
8 var s = GetCurrentSource();
9 if (ShowSourceChanged != null)
10 {
11 ShowSourceChanged(s);
12 }
13 }
14
15 public override void PreviousPage()
16 {
17 if (PageIndex <= 1)
18 {
19 return;
20 }
21 PageIndex--;
22
23 StartIndex = (PageIndex - 1) * PageSize;
24 ReloadPage();
25 var s = GetCurrentSource();
26 if (ShowSourceChanged != null)
27 {
28 ShowSourceChanged(s);
29 }
30 }
31
32 public override void NextPage()
33 {
34 if (PageIndex >= PageCount)
35 {
36 return;
37 }
38 PageIndex++;
39 StartIndex = (PageIndex - 1) * PageSize;
40 ReloadPage();
41 var s = GetCurrentSource();
42 if (ShowSourceChanged != null)
43 {
44 ShowSourceChanged(s);
45 }
46 }
47
48 public override void EndPage()
49 {
50 if (PageIndex == PageCount)
51 return;
52 PageIndex = PageCount;
53 StartIndex = (PageIndex - 1) * PageSize;
54 ReloadPage();
55 var s = GetCurrentSource();
56 if (ShowSourceChanged != null)
57 {
58 ShowSourceChanged(s);
59 }
60 }
61
62 protected override void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
63 {
64 btnFirst.Enabled = btnPrevious.Enabled = blnLeftBtn;
65 btnNext.Enabled = btnEnd.Enabled = blnRightBtn;
66 }
一个重置总页数的函数
1 private void ResetPageCount()
2 {
3 if (PageSize > 0)
4 {
5 PageCount = m_dataSource.Count / m_intPageSize + (m_dataSource.Count % m_intPageSize > 0 ? 1 : 0);
6 }
7 txtPage.MaxValue = PageCount;
8 txtPage.MinValue = 1;
9 ReloadPage();
10 }
一个重置计算当前页码列表的函数
private void ReloadPage()
{
try
{
ControlHelper.FreezeControl(tableLayoutPanel1, true);
List lst = new List();
if (PageCount <= 9)
{
for (var i = 1; i <= PageCount; i++)
{
lst.Add(i);
}
}
else
{
if (this.PageIndex <= 6)
{
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
{
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 < 9; i++)
{
UCBtnExt c = (UCBtnExt)this.tableLayoutPanel1.Controls.Find("p" + (i + 1), false)[0];
if (i >= lst.Count)
{
c.Visible = false;
}
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)
{
c.RectColor = Color.FromArgb(255, 77, 59);
}
else
{
c.RectColor = Color.FromArgb(223, 223, 223);
}
}
}
ShowBtn(PageIndex > 1, PageIndex < PageCount);
}
finally
{
ControlHelper.FreezeControl(tableLayoutPanel1, false);
}
}
跳转页面
1 private void page_BtnClick(object sender, EventArgs e)
2 {
3 PageIndex = (sender as UCBtnExt).BtnText.ToInt();
4 StartIndex = (PageIndex - 1) * PageSize;
5 ReloadPage();
6 var s = GetCurrentSource();
7
8 if (ShowSourceChanged != null)
9 {
10 ShowSourceChanged(s);
11 }
12 }
13 private void btnFirst_BtnClick(object sender, EventArgs e)
14 {
15 FirstPage();
16 }
17
18 private void btnPrevious_BtnClick(object sender, EventArgs e)
19 {
20 PreviousPage();
21 }
22
23 private void btnNext_BtnClick(object sender, EventArgs e)
24 {
25 NextPage();
26 }
27
28 private void btnEnd_BtnClick(object sender, EventArgs e)
29 {
30 EndPage();
31 }
32
33 private void btnToPage_BtnClick(object sender, EventArgs e)
34 {
35 if (!string.IsNullOrEmpty(txtPage.InputText))
36 {
37 PageIndex = txtPage.InputText.ToInt();
38 StartIndex = (PageIndex - 1) * PageSize;
39 ReloadPage();
40 var s = GetCurrentSource();
41 if (ShowSourceChanged != null)
42 {
43 ShowSourceChanged(s);
44 }
45 }
46 }
至此完成所有逻辑,看下完整代码
// 版权所有 黄正辉 交流群:568015492 QQ:623128629
// 文件名称:UCPagerControl2.cs
// 创建日期:2019-08-15 16:00:37
// 功能描述:PageControl
// 项目地址:https://gitee.com/kwwwvagaa/net_winform_custom_control
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls.List
{
[ToolboxItem(true)]
public partial class UCPagerControl2 : UCPagerControlBase
{
public UCPagerControl2()
{
InitializeComponent();
txtPage.txtInput.KeyDown += txtInput_KeyDown;
}
void txtInput_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
btnToPage_BtnClick(null, null);
txtPage.InputText = "";
}
}
public override event PageControlEventHandler ShowSourceChanged;
private List m_dataSource;
public override List DataSource
{
get
{
return m_dataSource;
}
set
{
m_dataSource = value;
if (m_dataSource == null)
m_dataSource = new List();
ResetPageCount();
}
}
private int m_intPageSize = 0;
public override int PageSize
{
get
{
return m_intPageSize;
}
set
{
m_intPageSize = value;
ResetPageCount();
}
}
public override void FirstPage()
{
if (PageIndex == 1)
return;
PageIndex = 1;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
public override void PreviousPage()
{
if (PageIndex <= 1)
{
return;
}
PageIndex--;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
public override void NextPage()
{
if (PageIndex >= PageCount)
{
return;
}
PageIndex++;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
public override void EndPage()
{
if (PageIndex == PageCount)
return;
PageIndex = PageCount;
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
private void ResetPageCount()
{
if (PageSize > 0)
{
PageCount = m_dataSource.Count / m_intPageSize + (m_dataSource.Count % m_intPageSize > 0 ? 1 : 0);
}
txtPage.MaxValue = PageCount;
txtPage.MinValue = 1;
ReloadPage();
}
private void ReloadPage()
{
try
{
ControlHelper.FreezeControl(tableLayoutPanel1, true);
List lst = new List();
if (PageCount <= 9)
{
for (var i = 1; i <= PageCount; i++)
{
lst.Add(i);
}
}
else
{
if (this.PageIndex <= 6)
{
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
{
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 < 9; i++)
{
UCBtnExt c = (UCBtnExt)this.tableLayoutPanel1.Controls.Find("p" + (i + 1), false)[0];
if (i >= lst.Count)
{
c.Visible = false;
}
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)
{
c.RectColor = Color.FromArgb(255, 77, 59);
}
else
{
c.RectColor = Color.FromArgb(223, 223, 223);
}
}
}
ShowBtn(PageIndex > 1, PageIndex < PageCount);
}
finally
{
ControlHelper.FreezeControl(tableLayoutPanel1, false);
}
}
private void page_BtnClick(object sender, EventArgs e)
{
PageIndex = (sender as UCBtnExt).BtnText.ToInt();
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
protected override void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
{
btnFirst.Enabled = btnPrevious.Enabled = blnLeftBtn;
btnNext.Enabled = btnEnd.Enabled = blnRightBtn;
}
private void btnFirst_BtnClick(object sender, EventArgs e)
{
FirstPage();
}
private void btnPrevious_BtnClick(object sender, EventArgs e)
{
PreviousPage();
}
private void btnNext_BtnClick(object sender, EventArgs e)
{
NextPage();
}
private void btnEnd_BtnClick(object sender, EventArgs e)
{
EndPage();
}
private void btnToPage_BtnClick(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtPage.InputText))
{
PageIndex = txtPage.InputText.ToInt();
StartIndex = (PageIndex - 1) * PageSize;
ReloadPage();
var s = GetCurrentSource();
if (ShowSourceChanged != null)
{
ShowSourceChanged(s);
}
}
}
}
}
namespace HZH_Controls.Controls.List
{
partial class UCPagerControl2
{
///
/// 必需的设计器变量。
///
private System.ComponentModel.IContainer components = null;
///
/// 清理所有正在使用的资源。
///
/// 如果应释放托管资源,为 true;否则为 false。
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
///
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
///
private void InitializeComponent()
{
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.txtPage = new HZH_Controls.Controls.UCTextBoxEx();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnFirst
//
this.btnFirst.BackColor = System.Drawing.Color.White;
this.btnFirst.BtnBackColor = System.Drawing.Color.White;
this.btnFirst.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.btnFirst.BtnForeColor = System.Drawing.Color.Gray;
this.btnFirst.BtnText = "<<";
this.btnFirst.ConerRadius = 5;
this.btnFirst.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnFirst.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnFirst.FillColor = System.Drawing.Color.White;
this.btnFirst.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnFirst.IsRadius = true;
this.btnFirst.IsShowRect = true;
this.btnFirst.IsShowTips = false;
this.btnFirst.Location = new System.Drawing.Point(5, 5);
this.btnFirst.Margin = new System.Windows.Forms.Padding(5);
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(30, 30);
this.btnFirst.TabIndex = 0;
this.btnFirst.TabStop = false;
this.btnFirst.TipsText = "";
this.btnFirst.BtnClick += new System.EventHandler(this.btnFirst_BtnClick);
//
// btnPrevious
//
this.btnPrevious.BackColor = System.Drawing.Color.White;
this.btnPrevious.BtnBackColor = System.Drawing.Color.White;
this.btnPrevious.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.btnPrevious.BtnForeColor = System.Drawing.Color.Gray;
this.btnPrevious.BtnText = "<";
this.btnPrevious.ConerRadius = 5;
this.btnPrevious.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnPrevious.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnPrevious.FillColor = System.Drawing.Color.White;
this.btnPrevious.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnPrevious.IsRadius = true;
this.btnPrevious.IsShowRect = true;
this.btnPrevious.IsShowTips = false;
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(30, 30);
this.btnPrevious.TabIndex = 1;
this.btnPrevious.TabStop = false;
this.btnPrevious.TipsText = "";
this.btnPrevious.BtnClick += new System.EventHandler(this.btnPrevious_BtnClick);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
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));
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, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
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.btnPrevious, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.btnFirst, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.txtPage, 13, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(129, 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(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;
this.btnToPage.BtnBackColor = System.Drawing.Color.White;
this.btnToPage.BtnFont = new System.Drawing.Font("微软雅黑", 11F);
this.btnToPage.BtnForeColor = System.Drawing.Color.Gray;
this.btnToPage.BtnText = "跳转";
this.btnToPage.ConerRadius = 5;
this.btnToPage.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnToPage.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnToPage.FillColor = System.Drawing.Color.White;
this.btnToPage.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnToPage.IsRadius = true;
this.btnToPage.IsShowRect = true;
this.btnToPage.IsShowTips = false;
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(62, 30);
this.btnToPage.TabIndex = 15;
this.btnToPage.TabStop = false;
this.btnToPage.TipsText = "";
this.btnToPage.BtnClick += new System.EventHandler(this.btnToPage_BtnClick);
//
// btnEnd
//
this.btnEnd.BackColor = System.Drawing.Color.White;
this.btnEnd.BtnBackColor = System.Drawing.Color.White;
this.btnEnd.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.btnEnd.BtnForeColor = System.Drawing.Color.Gray;
this.btnEnd.BtnText = ">>";
this.btnEnd.ConerRadius = 5;
this.btnEnd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnEnd.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnEnd.FillColor = System.Drawing.Color.White;
this.btnEnd.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnEnd.IsRadius = true;
this.btnEnd.IsShowRect = true;
this.btnEnd.IsShowTips = false;
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(30, 30);
this.btnEnd.TabIndex = 13;
this.btnEnd.TabStop = false;
this.btnEnd.TipsText = "";
this.btnEnd.BtnClick += new System.EventHandler(this.btnEnd_BtnClick);
//
// btnNext
//
this.btnNext.BackColor = System.Drawing.Color.White;
this.btnNext.BtnBackColor = System.Drawing.Color.White;
this.btnNext.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.btnNext.BtnForeColor = System.Drawing.Color.Gray;
this.btnNext.BtnText = ">";
this.btnNext.ConerRadius = 5;
this.btnNext.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnNext.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnNext.FillColor = System.Drawing.Color.White;
this.btnNext.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnNext.IsRadius = true;
this.btnNext.IsShowRect = true;
this.btnNext.IsShowTips = false;
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(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;
this.p7.BtnBackColor = System.Drawing.Color.White;
this.p7.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p7.BtnForeColor = System.Drawing.Color.Gray;
this.p7.BtnText = "7";
this.p7.ConerRadius = 5;
this.p7.Cursor = System.Windows.Forms.Cursors.Hand;
this.p7.Dock = System.Windows.Forms.DockStyle.Fill;
this.p7.FillColor = System.Drawing.Color.White;
this.p7.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p7.IsRadius = true;
this.p7.IsShowRect = true;
this.p7.IsShowTips = false;
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 = 7;
this.p7.TabStop = false;
this.p7.TipsText = "";
this.p7.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// p6
//
this.p6.BackColor = System.Drawing.Color.White;
this.p6.BtnBackColor = System.Drawing.Color.White;
this.p6.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p6.BtnForeColor = System.Drawing.Color.Gray;
this.p6.BtnText = "6";
this.p6.ConerRadius = 5;
this.p6.Cursor = System.Windows.Forms.Cursors.Hand;
this.p6.Dock = System.Windows.Forms.DockStyle.Fill;
this.p6.FillColor = System.Drawing.Color.White;
this.p6.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p6.IsRadius = true;
this.p6.IsShowRect = true;
this.p6.IsShowTips = false;
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 = 6;
this.p6.TabStop = false;
this.p6.TipsText = "";
this.p6.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// p5
//
this.p5.BackColor = System.Drawing.Color.White;
this.p5.BtnBackColor = System.Drawing.Color.White;
this.p5.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p5.BtnForeColor = System.Drawing.Color.Gray;
this.p5.BtnText = "5";
this.p5.ConerRadius = 5;
this.p5.Cursor = System.Windows.Forms.Cursors.Hand;
this.p5.Dock = System.Windows.Forms.DockStyle.Fill;
this.p5.FillColor = System.Drawing.Color.White;
this.p5.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p5.IsRadius = true;
this.p5.IsShowRect = true;
this.p5.IsShowTips = false;
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 = 5;
this.p5.TabStop = false;
this.p5.TipsText = "";
this.p5.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// p4
//
this.p4.BackColor = System.Drawing.Color.White;
this.p4.BtnBackColor = System.Drawing.Color.White;
this.p4.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p4.BtnForeColor = System.Drawing.Color.Gray;
this.p4.BtnText = "4";
this.p4.ConerRadius = 5;
this.p4.Cursor = System.Windows.Forms.Cursors.Hand;
this.p4.Dock = System.Windows.Forms.DockStyle.Fill;
this.p4.FillColor = System.Drawing.Color.White;
this.p4.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p4.IsRadius = true;
this.p4.IsShowRect = true;
this.p4.IsShowTips = false;
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 = 4;
this.p4.TabStop = false;
this.p4.TipsText = "";
this.p4.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// p3
//
this.p3.BackColor = System.Drawing.Color.White;
this.p3.BtnBackColor = System.Drawing.Color.White;
this.p3.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p3.BtnForeColor = System.Drawing.Color.Gray;
this.p3.BtnText = "3";
this.p3.ConerRadius = 5;
this.p3.Cursor = System.Windows.Forms.Cursors.Hand;
this.p3.Dock = System.Windows.Forms.DockStyle.Fill;
this.p3.FillColor = System.Drawing.Color.White;
this.p3.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p3.IsRadius = true;
this.p3.IsShowRect = true;
this.p3.IsShowTips = false;
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 = 3;
this.p3.TabStop = false;
this.p3.TipsText = "";
this.p3.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// p2
//
this.p2.BackColor = System.Drawing.Color.White;
this.p2.BtnBackColor = System.Drawing.Color.White;
this.p2.BtnFont = new System.Drawing.Font("微软雅黑", 9F);
this.p2.BtnForeColor = System.Drawing.Color.Gray;
this.p2.BtnText = "2";
this.p2.ConerRadius = 5;
this.p2.Cursor = System.Windows.Forms.Cursors.Hand;
this.p2.Dock = System.Windows.Forms.DockStyle.Fill;
this.p2.FillColor = System.Drawing.Color.White;
this.p2.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.p2.IsRadius = true;
this.p2.IsShowRect = true;
this.p2.IsShowTips = false;
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 = 2;
this.p2.TabStop = false;
this.p2.TipsText = "";
this.p2.BtnClick += new System.EventHandler(this.page_BtnClick);
//
// txtPage
//
this.txtPage.BackColor = System.Drawing.Color.Transparent;
this.txtPage.ConerRadius = 5;
this.txtPage.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtPage.DecLength = 2;
this.txtPage.FillColor = System.Drawing.Color.Empty;
this.txtPage.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtPage.ForeColor = System.Drawing.Color.Gray;
this.txtPage.InputText = "";
this.txtPage.InputType = HZH_Controls.TextInputType.PositiveInteger;
this.txtPage.IsFocusColor = true;
this.txtPage.IsRadius = true;
this.txtPage.IsShowClearBtn = false;
this.txtPage.IsShowKeyboard = false;
this.txtPage.IsShowRect = true;
this.txtPage.IsShowSearchBtn = false;
this.txtPage.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN;
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,
0,
0,
0});
this.txtPage.MinValue = new decimal(new int[] {
1000000,
0,
0,
-2147483648});
this.txtPage.Name = "txtPage";
this.txtPage.Padding = new System.Windows.Forms.Padding(5);
this.txtPage.PromptColor = System.Drawing.Color.Silver;
this.txtPage.PromptFont = new System.Drawing.Font("微软雅黑", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtPage.PromptText = "页码";
this.txtPage.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.txtPage.RectWidth = 1;
this.txtPage.RegexPattern = "";
this.txtPage.Size = new System.Drawing.Size(62, 30);
this.txtPage.TabIndex = 14;
//
// UCPagerControl2
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "UCPagerControl2";
this.Size = new System.Drawing.Size(921, 41);
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private UCBtnExt btnFirst;
private UCBtnExt btnPrevious;
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 btnToPage;
private UCTextBoxEx txtPage;
private UCBtnExt p9;
private UCBtnExt p1;
}
}
如果你喜欢的话,请到 https://gitee.com/kwwwvagaa/net_winform_custom_control 点个星 星吧