當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。