本文整理汇总了C#中System.Windows.Forms.KeyPressEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# KeyPressEventArgs类的具体用法?C# KeyPressEventArgs怎么用?C# KeyPressEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyPressEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了KeyPressEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: textBox1_KeyPress
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if ("1234567890".IndexOf(e.KeyChar) == -1 && e.KeyChar != '\b')
{
e.Handled = true;
}
}
开发者ID:et5494,项目名称:BUSTERS,代码行数:7,代码来源:Form1.cs
示例2: tbConfirmPw_KeyPress
private void tbConfirmPw_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
btnChangePw_Click(sender, e);
}
}
开发者ID:UristMcMiner,项目名称:SE-Projekt_RWB.csharp,代码行数:7,代码来源:formForgotPw.cs
示例3: playerTwo_KeyPress
private void playerTwo_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar.ToString() == "\r")
{
playButton.PerformClick();
}
}
开发者ID:Seniority,项目名称:TicTacToe,代码行数:7,代码来源:Form2.cs
示例4: Contrasena_KeyPress
private void Contrasena_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
this.IngresarButton_Click(null, null);
}
}
开发者ID:Xidrovo,项目名称:BaseDeDatos,代码行数:7,代码来源:Title1.cs
示例5: txt_rut_KeyPress
private void txt_rut_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Convert.ToChar(Keys.Enter))
{
RutVerificar();
}
}
开发者ID:FJSOTO,项目名称:Tienda-Plaza,代码行数:7,代码来源:PagoCuenta.cs
示例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);
}
开发者ID:ploegert,项目名称:ganshani,代码行数:31,代码来源:CustomTextBox.cs
示例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;
}
}
开发者ID:galst1234,项目名称:ShopKeep,代码行数:7,代码来源:AddNewItemType.cs
示例8: tbxServerPort_KeyPress
void tbxServerPort_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}
开发者ID:JonasVanGool,项目名称:EnsorExternSimulation,代码行数:7,代码来源:EnsorExternIOForm.cs
示例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();
}
开发者ID:suwadee2015,项目名称:GPS,代码行数:7,代码来源:FormCarServiceTime.cs
示例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();
}
开发者ID:nodoid,项目名称:PointOfSale,代码行数:31,代码来源:frmStockList2.cs
示例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;
}
}
开发者ID:DanylZhang,项目名称:CurriculumDesign,代码行数:7,代码来源:TextBoxFilterByKeyPress.cs
示例12: listBox1_KeyPress
private void listBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
this.Close();
}
}
开发者ID:przemekwa,项目名称:pogoda,代码行数:7,代码来源:Form3.cs
示例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;
}
开发者ID:modulexcite,项目名称:ListControls,代码行数:12,代码来源:NumericTextBox.cs
示例14: PowerForm_KeyPress
private void PowerForm_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)0x1B)
{
CloseAndApply();
}
}
开发者ID:tony2124,项目名称:traza,代码行数:7,代码来源:PowerForm.cs
示例15: textBox1_KeyPress
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
this.button1_Click(sender, e);
}
}
开发者ID:OCT15,项目名称:TCM-CSharp,代码行数:7,代码来源:frmCompra_Estq.cs
示例16: data_KeyPress
// este evento resolve a maioria dos problemas com a introdução
// de valores inválidos nas datas, no entanto, ficam por tratar
// outros modos de introdução dos dados (por exemplo fazendo "paste").
// embora geralmente não seja um problema pode se-lo nos casos em
// que se torne necessário forçar um endedit.
public void data_KeyPress(object sender, KeyPressEventArgs e)
{
if (! (char.IsDigit(e.KeyChar)) && ! (e.KeyChar == '?') && ! (char.IsControl(e.KeyChar)))
{
e.Handled = true;
}
}
开发者ID:aureliopires,项目名称:gisa,代码行数:12,代码来源:ControloDateValidation.cs
示例17: ChatInput_KeyPress
private void ChatInput_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
if (ChatInput.Text == "")
return;
if (IsPrivate && ChatInput.Text.StartsWith("/me"))
{
WriteMessage(new ChatMessage(MessageType.Message, CommandType.Me, Program.UserInfo, Name,Program.UserInfo.username + " " + ChatInput.Text.Replace("/me","").Trim()));
Program.ChatServer.SendMessage(MessageType.PrivateMessage, CommandType.Me, Name, ChatInput.Text.Substring(4));
}
else if (IsPrivate && ChatInput.Text.StartsWith("/"))
{
WriteMessage(new ChatMessage(MessageType.System, CommandType.None, Name, "Unknown Command."));
ChatInput.Clear();
e.Handled = true;
return;
}
else if (IsPrivate)
{
WriteMessage(new ChatMessage(MessageType.PrivateMessage, CommandType.None, Program.UserInfo, Name, ChatInput.Text));
Program.ChatServer.SendMessage(MessageType.PrivateMessage, CommandType.None, Name, ChatInput.Text);
}
ChatInput.Clear();
e.Handled = true;
}
}
开发者ID:Bromantic,项目名称:DevProLauncher,代码行数:28,代码来源:PmWindow_frm.cs
示例18: ListatextBox_KeyPress
private void ListatextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if ((e.KeyChar >= 48 && e.KeyChar <= 57) || (e.KeyChar >= 97 && e.KeyChar <= 122) || (e.KeyChar >= 65 && e.KeyChar <= 90) || (e.KeyChar == 8))
e.Handled = false;
else
e.Handled = true;
}
开发者ID:AlbertPadi,项目名称:CocoaExportProyect,代码行数:7,代码来源:ListarCertificaciones.cs
示例19: customerIDBox_KeyPress
private void customerIDBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsDigit(e.KeyChar) && !(e.KeyChar == (char)Keys.Back) && !(e.KeyChar == (char)Keys.Delete))
{
e.Handled = true;
}
}
开发者ID:ShruthaKashyap,项目名称:ApteanEdgeBank,代码行数:7,代码来源:CloseAccount.cs
示例20: txtNum1_KeyPress
private void txtNum1_KeyPress(object sender, KeyPressEventArgs e)
{
if ((txtNum1.Text.Trim() + e.KeyChar.ToString()).Split('.').Length > 2)
e.Handled = true;
else if (!char.IsNumber(e.KeyChar) && (Keys)e.KeyChar != Keys.Back && e.KeyChar != '.')
e.Handled = true;
}
开发者ID:TeerapongSSD,项目名称:Training_C_Sharp,代码行数:7,代码来源:frmCalculate.cs
注:本文中的System.Windows.Forms.KeyPressEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论