简体   繁体   English

屏幕键盘C#上的空格键

[英]spacebar on OnScreen Keyboard C#

I start programming this week and my partner gave me a onscreen keyboard to do. 我本周开始编程,我的伴侣给了我一个屏幕键盘来做。 I only need to click on spacebar on the keyboard and show a space on my textbox, how do a do that? 我只需要单击键盘上的空格键,然后在我的文本框中显示一个空格,该怎么办?

    private void btnSpace_Click(object sender, EventArgs e)
    {

    }

Thanks 谢谢

If you have a TextBox with the Name MyTextBox you could do: 如果您有一个名称为MyTextBoxTextBox ,则可以执行以下操作:

this.MyTextBox.Text = " ";

or if you want to add a Space : 或者如果您想添加一个Space

this.myTextBox.Text += " ";

I solved my own problem. 我解决了自己的问题。 I added one line of code: 我添加了一行代码:

MyTextBox.Text += (sender as Button).Text; 

On the code and set the spacebar button text to " ". 在代码上,将空格键按钮文本设置为“”。 Now when I click on the spacebar button it shows a space. 现在,当我单击空格键时,它将显示一个空格。 To identify the spacebar button I've used a png image with "spacebar" on it. 为了识别空格键,我使用了带有“空格键”的png图像。

Thanks for all of you that tried to help me. 感谢所有试图帮助我的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM