private void tsbtn_Click(object sender, EventArgs e) { ToolStripItem btn = sender as ToolStripItem; if (btn == null) return; PagingEventArgs pe = new PagingEventArgs(); pe.CurrentPage = this.CurrentPage; switch (btn.Name) { case "tsbtnFirstPage": pe.JumpToPage = 1; if (OnFirstPage != null) OnFirstPage(this, pe); break; case "tsbtnPageUp": pe.JumpToPage = CurrentPage - 1; if (OnPageUp != null) OnPageUp(this, pe); break; case "tsbtnPageDown": pe.JumpToPage = CurrentPage + 1; if (OnPageDown != null) OnPageDown(this, pe); break; case "tsbtnLastPage": pe.JumpToPage = -1; if (OnLastPage != null) OnLastPage(this, pe); break; case "tsbtnReload": pe.JumpToPage = CurrentPage; if (OnReload != null) OnReload(this, pe); break; default: break; } }
private void tstxtPage_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { tstxtPage_TextChanged(sender, e); PagingEventArgs pe = new PagingEventArgs(); pe.JumpToPage = System.Convert.ToInt32(tstxtPage.Text); if (OnJumpToPage!=null) OnJumpToPage(this, pe); } }