繁体   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