/// <summary> /// 页数限制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtPageNum_TextChanged(object sender, EventArgs e) { string strNum = this.txtPageNum.Text.Trim(); if (strNum.Length > 0 && RegUtil.IsPositiveNumber(strNum) && int.Parse(strNum) > PageCount) { txtPageNum.Text = PageCount.ToString(); } }
/// <summary> /// enter键功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtPageNum_KeyPress(object sender, KeyPressEventArgs e) { string strNum = this.txtPageNum.Text.Trim(); if (e.KeyChar == (char)Keys.Enter && RegUtil.IsPositiveNumber(strNum)) { CurrentPage = int.Parse(strNum); DrawControl(); } }
/// <summary> /// 跳转 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGo_Click(object sender, EventArgs e) { string strNum = this.txtPageNum.Text.Trim(); if (RegUtil.IsPositiveNumber(strNum) == false) { return; } CurrentPage = int.Parse(strNum); DrawControl(); }