資源簡介
本(C#)Winform分頁控件不于具體的數據源相關聯,簡單實用,可以隨時設置每頁顯示記錄行數和頁數
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
namespace?WindowsFormsApplication1?{
????///?
????///?測試窗口
????///?測試猛犸Winform分頁控件?(.net4.0框架)
????///?本Winform分頁控件不于具體的數據源相關聯,簡單實用
????///?
????///?使用方法:在VS的工具箱右鍵>選擇項...,在彈出的對話框默認選項卡里點“瀏覽...“,
????///?選擇Mammoth.Winform.Pager.dll后勾選Pager按“確定”按鈕,
????///?工具欄上將出現Pager控件,就可以把它拖到你的目標窗口了。
????///?
????///?www.ycsk.net?2014-10-28
????///?
????public?partial?class?Form1?:?Form?{
????????public?Form1()?{
????????????InitializeComponent();
????????????//
????????????BindGrid();
????????}
????????private?void?BindGrid()?{
????????????//查詢條件
????????????string?sqlwhere=““;//你的查詢條件
????????????int?total?=?100;???//測試設置總記錄數為100
????????????//bll?實例化你的業務對象getData()你的獲取數據方法,返回的數據集可以是DataTable、DataSet或者List<你的實體>、IList<你的實體>
????????????//DataTable?data?=?bll.getData(pager1.PageIndex?pager1.PageSize?sqlwhereout?total);?//第一頁時請輸出總記錄條數
????????????//第一頁時必須設置一下pager1.SetTotal()
????????????if?(pager1.PageIndex?==?1)?{
????????????????pager1.SetTotal(total);//傳入總記錄數進行初始化???????????????
????????????}
????????????//下面這句是給記錄集行間導航的,可用可不用。
????????????//pager1.bindingNavigator.BindingSource?=?data;
????????}
????????///?
????????///?分頁事件
????????///?
????????///?
????????private?void?pager1_PageIndexChanged(Mammoth.WinForm.EventPagingArg?e)?{
????????????//MessageBox.Show(e.PageIndex.ToString());?//彈出最新頁碼索引
????????????BindGrid();
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????22528??2014-10-28?09:42??WindowsFormsApplication1\bin\Release\Mammoth.WinForm.Pager.dll
?????文件???????9216??2014-10-28?10:12??WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.exe
?????文件???????2117??2014-10-28?10:37??WindowsFormsApplication1\Form1.cs
?????文件???????4114??2014-10-28?09:55??WindowsFormsApplication1\Form1.Designer.cs
?????文件???????6369??2014-10-28?09:55??WindowsFormsApplication1\Form1.resx
?????文件????????490??2014-10-28?09:32??WindowsFormsApplication1\Program.cs
?????文件???????1380??2014-10-28?09:32??WindowsFormsApplication1\Properties\AssemblyInfo.cs
?????文件???????2807??2014-10-28?09:32??WindowsFormsApplication1\Properties\Resources.Designer.cs
?????文件???????5612??2014-10-28?09:32??WindowsFormsApplication1\Properties\Resources.resx
?????文件???????1079??2014-10-28?09:32??WindowsFormsApplication1\Properties\Settings.Designer.cs
?????文件????????249??2014-10-28?09:32??WindowsFormsApplication1\Properties\Settings.settings
?????文件???????3903??2014-10-28?09:41??WindowsFormsApplication1\WindowsFormsApplication1.csproj
?????文件??????22528??2014-10-28?09:42??Libs\Mammoth.WinForm.Pager.dll
?????文件??????22016??2014-10-28?09:42??Libs\Mammoth.WinForm.Pager.pdb
?????目錄??????????0??2014-10-28?09:32??WindowsFormsApplication1\bin\Debug
?????目錄??????????0??2014-10-28?10:22??WindowsFormsApplication1\bin\Release
?????目錄??????????0??2014-10-28?09:32??WindowsFormsApplication1\bin
?????目錄??????????0??2014-10-28?09:32??WindowsFormsApplication1\Properties
?????目錄??????????0??2014-10-28?10:20??WindowsFormsApplication1
?????目錄??????????0??2014-10-28?09:38??Libs
-----------?---------??----------?-----??----
???????????????104408????????????????????20
- 上一篇:用VS2010做的繪圖板C#
- 下一篇:C# 矩陣運算實數+復數
評論
共有 條評論