简体   繁体   English

当我按(*)如何在TextBox中获取(。)(在C#WinCE中)

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

when i press (*) how to get (.) in TextBox (in C# WinCE) 当我按(*)如何在TextBox中获取(。)(在C#WinCE中)

i have TextBox and when i press the (*) letter i want to get the (.) letter 我有TextBox,当我按(*)字母时,我想获得(。)字母

thank's in advance 提前致谢

Use the keypress and if the key is a '*' then replace it with '.'? 使用按键,如果按键是“ *”,则将其替换为“。”?

see here 看这里

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

if you can't set the e.KeyCode then you can do: 如果您无法设置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