Winform 開發中分頁控制項不可或缺,Web 開發有 AspNetPager 方便分頁顯示。NSun.NPage 基於 BindingNavigator 二次開發,讓 Winform 分頁更便利。



DisplayStyle:顯示類型(圖片/文字)TextImageRelationShow:圖文顯示位置FirstItemText、NextItemText、PreviousItemText、LastItemText:四大按鈕文字IsComBox:是否顯示下拉選單PageSize:每頁筆數RecordCount:總筆數CurrentPageIndex:目前頁碼(從 1 開始)PageChanged:頁碼變更後PageChanging:頁碼變更前public partial class Form1 : Form
{
DBQuery<LogInfo> db = new DBQuery<LogInfo>(ConnectionDBQuery.Default);
public Form1() { InitializeComponent(); }
private void commonPage1_PageChanged(object o, NSun.NPage.PageChangingEventArgs e)
{
nSunPage1.CurrentPageIndex = e.NewPageIndex;
Bind();
}
private void Bind()
{
int countpage;
DataTable dt = db.SelectPageToDataTable(nSunPage1.PageSize, nSunPage1.CurrentPageIndex, out countpage);
dataGridView1.DataSource = dt;
nSunPage1.RecordCount = countpage;
}
private void Form1_Load(object sender, EventArgs e) { Bind(); }
}
下載連結:NSun.Npage.rar