功能调整
This commit is contained in:
1 parent
42acf1b1cb
commit
772d9f4780
40 files changed
+4953
-389
No files matched your search
@@ -0,0 +1,151 @@
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Work.UserControls
|
||||
{
|
||||
public partial class UcSplitPage : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否显示每页条数(启用每页条数功能)
|
||||
/// </summary>
|
||||
[Description("显示每页条数"), Category("UserProperty")]
|
||||
public bool IsShowPageSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.cmbPageSize.Visible;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (cmbPageSize.Visible != value)
|
||||
{
|
||||
this.lblPageSize.Visible = this.cmbPageSize.Visible = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int totalPage = 1;
|
||||
public int TotalPage
|
||||
{
|
||||
get { return totalPage; }
|
||||
set
|
||||
{
|
||||
if (TotalPage != value && value > 0)
|
||||
{
|
||||
totalPage = value;
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.lblTotal.Text = "共 " + totalPage + " 页";
|
||||
}));
|
||||
}
|
||||
else
|
||||
this.lblTotal.Text = "共 " + totalPage + " 页";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int currentPage = 1;
|
||||
public int CurrentPage
|
||||
{
|
||||
get { return currentPage; }
|
||||
set
|
||||
{
|
||||
if (currentPage != value)
|
||||
{
|
||||
currentPage = value;
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.lblPage.Text = "" + currentPage;
|
||||
}));
|
||||
}
|
||||
else
|
||||
this.lblPage.Text = "" + currentPage;
|
||||
}
|
||||
OnPageChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
[Description("每页条数"), Category("UserProperty")]
|
||||
public int PageSize
|
||||
{
|
||||
get
|
||||
{
|
||||
int pageSize = 50;
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
pageSize = Math.Max(this.cmbPageSize.Text.ParseToInt(), 1);
|
||||
}));
|
||||
}
|
||||
else
|
||||
pageSize = Math.Max(this.cmbPageSize.Text.ParseToInt(), 1);
|
||||
return pageSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (this.cmbPageSize.Text.ParseToInt() != value)
|
||||
this.cmbPageSize.Text = value.ParseToString();
|
||||
else
|
||||
this.cmbPageSize.Text = value.ParseToString();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.cmbPageSize.Text.ParseToInt() != value)
|
||||
this.cmbPageSize.Text = value.ParseToString();
|
||||
else
|
||||
this.cmbPageSize.Text = value.ParseToString();
|
||||
}
|
||||
//OnPageChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
public event Action<object> PageChange;
|
||||
protected virtual void OnPageChange(object sender)
|
||||
{
|
||||
this.PageChange?.Invoke(sender);
|
||||
}
|
||||
|
||||
public UcSplitPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void pnlJump_Click(object sender, EventArgs e)
|
||||
{
|
||||
int page = this.txtJumpPage.Text.ParseToInt();
|
||||
this.CurrentPage = Math.Max(1, page);
|
||||
|
||||
}
|
||||
|
||||
private void btnPrev_Click(object sender, EventArgs e)
|
||||
{
|
||||
int page = this.CurrentPage - 1;
|
||||
this.CurrentPage = Math.Max(1, page);
|
||||
}
|
||||
|
||||
private void btnNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
int page = this.CurrentPage + 1;
|
||||
this.CurrentPage = Math.Min(totalPage, page);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user