当前位置: 首页>>代码示例>>C#>>正文


C# Forms.KeyPressEventArgs类代码示例

本文整理汇总了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;
     }
 }
开发者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


注:本文中的System.Windows.Forms.KeyPressEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。