簡體   English   中英

當我按(*)如何在TextBox中獲取(。)(在C#WinCE中)

[英]when i press (*) how to get (.) in TextBox (in C# WinCE)

當我按(*)如何在TextBox中獲取(。)(在C#WinCE中)

我有TextBox,當我按(*)字母時,我想獲得(。)字母

提前致謝

使用按鍵,如果按鍵是“ *”,則將其替換為“。”?

看這里

private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
  if (e.KeyCode == Keys.Multiply) e.KeyCode = Keys.OemPeriod;
}

如果您無法設置e.KeyCode,則可以執行以下操作:

private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
    {
      if (e.KeyCode == Keys.Multiply) 
      {
        e.Handled = true;
        tb.Text += "."
      }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM