日期:2014-05-17 浏览次数:20754 次
protected override void OnKeyPress(KeyPressEventArgs e)
{
base.OnKeyPress(e);
if (char.IsDigit(e.KeyChar))
{
int value = int.Parse(this.Text == string.Empty ? "0": this.Text)*10 +int.Parse(e.KeyChar.ToString()) ;
if (value > 100 || value < 0)
{
e.Handled = true;
}
}
else
e.Handled = true;
}