如何在C#中创建屏幕键盘 [英] How do I create onscreen keyboard in C#

查看:139
本文介绍了如何在C#中创建屏幕键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中创建可以在同一个项目中使用的屏幕键盘

即时开发一个名为ABC的Windows窗体应用程序,客户端使用触摸屏显示器。所以我需要在屏幕键盘上使用这个application.i尝试下面的代码。

但它不会在同一个project.it工作在其他应用程序,如记事本,单词。



请有人帮助我谢谢你。



我的尝试:



how do i create Onscreen keyboard in c# that can use inside the same project
im developing a windows form application named ABC,client using touch screen monitor.so i needs to use on screen keyboard inside this application.i tried code below.
but it wont work on the same project.it works on the othere applications like note pad,word .

please someone help me thank you.

What I have tried:

 protected override CreateParams CreateParams
        {
            get
            {
                CreateParams param = base.CreateParams;
                param.ExStyle |= 0x08000000;
                return param;
            }
        }


private void button2_Click(object sender, EventArgs e)
        {
            SendKeys.Send("1");
        }

推荐答案

不容易......



1st您需要在提供TouchKeyboard的表单上创建一个方法。此方法必须查看您的任何文本框是否获得了焦点。也许它看起来你是否需要对TouchKeyboard有一个特殊的限制(例如只有数字输入)。

第二,你创建你的TouchKeyboard - 例如作为对话框。此对话框包含应使用的所有不同字符的所有按钮。每个按钮都会修改对话框的Text-Property(您需要并且不应该使用SendKeys)。如果您的输入已完成,您的Text-Property将保留最终输入。

3rd您的Form-method打开Dialog,因为它知道Dialog请求的Control,它也可以将Dialog匹配到调用Control 。当你的Dialog完成后,你只需要将它的Text-Property-Content写入调用控件。



...
Not an easy going ...

1st you need to create a Method on the Form which provides the TouchKeyboard. This Method has to look if any of your Textboxes got the Focus. Perhaps it looks also if you need a special restriction to the TouchKeyboard (for example only numeric inputs).
2nd you create your TouchKeyboard - for example as a Dialog. This Dialog holds all the Buttons for the different needed characters which should be used. Each of this Buttons modifies the Text-Property of your Dialog (you need and you should not use SendKeys). If your input is finished your Text-Property holds the final Input.
3rd your Form-method opens the Dialog and because it knows which Control the Dialog requested it could also position the Dialog matching to the calling Control. When your Dialog has finished you only need to write it''s Text-Property-Content to the calling Control.

...

这篇关于如何在C#中创建屏幕键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆