本文整理汇总了C#中System.Windows.Forms.KeyPressEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# KeyPressEventArgs类的具体用法?C# KeyPressEventArgs怎么用?C# KeyPressEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyPressEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了KeyPressEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: textBox1_KeyPress
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if ("1234567890".IndexOf(e.KeyChar) == -1 && e.KeyChar != '\b')
{
e.Handled = true;
}
}
示例2: tbConfirmPw_KeyPress
private void tbConfirmPw_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
btnChangePw_Click(sender, e);
}
}
示例3: playerTwo_KeyPress
private void playerTwo_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar.ToString() == "\r")
{
playButton.PerformClick();
}
}
示例4: Contrasena_KeyPress
private void Contrasena_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
this.IngresarButton_Click(null, null);
}
}
示例5: txt_rut_KeyPress
private void txt_rut_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Convert.ToChar(Keys.Enter))
{
RutVerificar();
}
}
示例6: OnKeyPress
protected override void OnKeyPress(KeyPressEventArgs e)
{
Keys keyPressed = (Keys)e.KeyChar;
if (_keys.Contains(keyPressed))
{
e.Handled = false;
}
else
{
bool handleAlphabets = true;
bool handleNumberic = true;
int ascii = (int)e.KeyChar;
if (_specialChars != null && (_specialChars.Contains(e.KeyChar)))
e.Handled = false;
else
{
handleAlphabets = (ascii >= 65 && ascii <= 90 || ascii >= 97 && ascii <= 122 || ascii == 32);
handleNumberic = ascii >= 48 && ascii <= 57;
e.Handled = (handleNumberic && _allowNumeric) || (handleAlphabets && _allowAlphabets);
e.Handled = !e.Handled;
}
}
if (e.Handled && BeepOnError)
new SoundPlayer().Play();
base.OnKeyPress(e);
}
示例7: PriceText_KeyPress
private void PriceText_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
{
e.Handled = true;
}
}
示例8: tbxServerPort_KeyPress
void tbxServerPort_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}
示例9: FormOverService_KeyPress
private void FormOverService_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar == 13)//enter
this.button1.PerformClick();
else if(e.KeyChar == 27)//esc
this.button2.PerformClick();
}
示例10: DataList1_DblClick
private void DataList1_DblClick(System.Object eventSender, KeyPressEventArgs eventArgs)
{
// ERROR: Not supported in C#: OnErrorStatement
if (string.IsNullOrEmpty(DataList1.BoundText))
return;
int lID = 0;
lID = Convert.ToInt32(DataList1.BoundText);
switch (gSection) {
case -1:
gID = Convert.ToInt32(DataList1.BoundText);
this.Close();
break;
case 0:
My.MyProject.Forms.frmStockItem.loadItem(ref Convert.ToInt32(DataList1.BoundText));
frmStockItem formItem = null;
formItem.Show();
break;
case 1:
My.MyProject.Forms.frmStockPricing.loadItem(ref Convert.ToInt32(DataList1.BoundText));
frmStockPricing formPrice = null;
formPrice.Show();
break;
case 2:
modApplication.report_StockQuantity(ref Convert.ToInt32(DataList1.BoundText));
break;
}
gRS.Requery();
//UPGRADE_NOTE: Refresh was upgraded to CtlRefresh. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
DataList1.CtlRefresh();
}
示例11: textBox1_KeyPress
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!((e.KeyChar >= '0' && e.KeyChar <= '9') || e.KeyChar == 8 || e.KeyChar == 13))
{
e.Handled = true;
}
}
示例12: listBox1_KeyPress
private void listBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.Close();
}
}
示例13: OnKeyPress
//=====================================================================
/// <summary>
/// Only allow digits to be entered and backspace to be pressed.
/// </summary>
/// <param name="e">The event arguments</param>
protected override void OnKeyPress(KeyPressEventArgs e)
{
if((e.KeyChar >= '0' && e.KeyChar <= '9') || e.KeyChar == '\b')
base.OnKeyPress(e);
else
e.Handled = true;
}
示例14: PowerForm_KeyPress
private void PowerForm_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)0x1B)
{
CloseAndApply();
}
}
示例15: textBox1_KeyPress
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
this.button1_Click(sender, e);
}
}