| | |
| | | public partial class PageBar : UserControl |
| | | { |
| | | public delegate void GetPageDataEvents(int curPage, int pageSize);//定义委托 |
| | | public event GetPageDataEvents williamPagerEvent;//定义事件 |
| | | public event GetPageDataEvents PagerEvent;//定义事件 |
| | | |
| | | public PageBar() |
| | | { |
| | |
| | | { |
| | | RowsCount = Convert.ToInt32(cbxRowCount.Text); |
| | | CurrentPage = 1; |
| | | if (williamPagerEvent != null) |
| | | if (PagerEvent != null) |
| | | BtnEvents(sender, e); |
| | | } |
| | | |
| | |
| | | { |
| | | CurrentPage = page; |
| | | } |
| | | if (williamPagerEvent != null) |
| | | if (PagerEvent != null) |
| | | BtnEvents(sender, e); |
| | | } |
| | | } |
| | |
| | | if (CurrentPage == 1) |
| | | return; |
| | | CurrentPage = 1; |
| | | if (williamPagerEvent != null) |
| | | if (PagerEvent != null) |
| | | BtnEvents(sender, e); |
| | | } |
| | | |
| | |
| | | { |
| | | CurrentPage -= 1; |
| | | } |
| | | if (williamPagerEvent != null) |
| | | if (PagerEvent != null) |
| | | BtnEvents(sender, e); |
| | | } |
| | | |
| | |
| | | { |
| | | CurrentPage += 1; |
| | | } |
| | | if (williamPagerEvent != null) |
| | | if (PagerEvent != null) |
| | | BtnEvents(sender, e); |
| | | } |
| | | |
| | |
| | | if (CurrentPage == TotalPages) |
| | | return; |
| | | CurrentPage = TotalPages; |
| | | if (williamPagerEvent != null) |
| | | if (PagerEvent != null) |
| | | BtnEvents(sender, e); |
| | | } |
| | | |
| | | private void BtnEvents(object sender, EventArgs e) |
| | | { |
| | | //setTxt(); |
| | | williamPagerEvent(CurrentPage, RowsCount); |
| | | PagerEvent(CurrentPage, RowsCount); |
| | | } |
| | | |
| | | public void setTxt() |