Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 触摸屏键盘_C#_Visual Studio 2008_Keyboard - Fatal编程技术网

C# 触摸屏键盘

C# 触摸屏键盘,c#,visual-studio-2008,keyboard,C#,Visual Studio 2008,Keyboard,我一直在开发触摸屏应用程序。我需要知道是否有一个现成的触摸屏键盘,我可以作为我的应用程序的控制器使用 我试着使用windows ready键盘,但它对于触摸屏来说太小了 Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + Path.DirectorySeparatorChar + "osk.exe"); 任何关于如何在最短时间内开始建造的想法都将不胜感激 新问题 我从某人那里复制了此代码,并对其

我一直在开发触摸屏应用程序。我需要知道是否有一个现成的触摸屏键盘,我可以作为我的应用程序的控制器使用

我试着使用windows ready键盘,但它对于触摸屏来说太小了

Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + Path.DirectorySeparatorChar + "osk.exe");
任何关于如何在最短时间内开始建造的想法都将不胜感激

新问题

我从某人那里复制了此代码,并对其进行了一些修改:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;


 class Win32
{
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern bool SetWindowPos(
int hWnd, // window handle
int hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
uint uFlags); // window positioning flags
public const int HWND_BOTTOM = 0x0001;
public const int HWND_TOP = 0x0000;
public const int SWP_NOSIZE = 0x0001;
public const int SWP_NOMOVE = 0x0002;
public const int SWP_NOZORDER = 0x0004;
public const int SWP_NOREDRAW = 0x0008;
public const int SWP_NOACTIVATE = 0x0010;
public const int SWP_FRAMECHANGED = 0x0020;
public const int SWP_SHOWWINDOW = 0x0040;
public const int SWP_HIDEWINDOW = 0x0080;
public const int SWP_NOCOPYBITS = 0x0100;
public const int SWP_NOOWNERZORDER = 0x0200;
public const int SWP_NOSENDCHANGING = 0x0400;
}


namespace Keyboard
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.KeyText.MouseDoubleClick += new MouseEventHandler(KeyText_MouseDoubleClick);

        }
        private Process process;
        private string getKeyboardText()
        {
            KeyScreen k = new KeyScreen();
            k.ShowDialog();
            if (k.DialogResult.ToString().Equals("OK"))
                return k.Text1;
            else
                return null;
        }

        void KeyText_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            this.KeyText.Text = getKeyboardText();
        }

        private void KeyBtn_Click(object sender, EventArgs e)
        {

            this.showKeypad();

            //Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + Path.DirectorySeparatorChar + "osk.exe");
        }
        private void showKeypad()
        {
            Process process = new Process();
            process.StartInfo.UseShellExecute = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError = true;
            process.StartInfo.CreateNoWindow = true;
            process.StartInfo.FileName = "c:\\Windows\\system32\\osk.exe";
            process.StartInfo.Arguments = "";
            process.StartInfo.WorkingDirectory = "c:\\";
            process.Start(); // Start Onscreen Keyboard
            process.WaitForInputIdle();
            Win32.SetWindowPos((int)process.MainWindowHandle,
            Win32.HWND_BOTTOM,
            300, 300, 1200, 600,
            Win32.SWP_SHOWWINDOW | Win32.SWP_NOZORDER);


        }



    }
}
这很好,我有一个很好的键盘(适合触摸屏),但是,我对C#和VB一点都不熟悉。。。。根据我显示的触摸屏键盘更改文本框中的文本


谢谢,

要创建自己的屏幕键盘,您基本上需要执行以下操作

1-创建一个windows键盘应用程序,该应用程序可以与之交互,但不会从当前控件中窃取输入焦点。当前控件中包含您当前使用的每个应用程序

2-键盘应用程序应向当前活动控件发送按键,以响应键盘应用程序中按钮的单击

我之前提供的以下答案提供了如何使用WinForms执行此操作的简单演示

基本上,该窗口是使用样式创建的,这样可以防止窗口处于活动状态并调整输入焦点。然后,作为对按钮点击的响应,它将使用相应的按键信息发送给具有输入焦点的控件

下面的答案显示了如何将样式应用于WPF应用程序


除了WS_EX_NOACTIVATE之外,还有其他解决方案,但这很简单,在拖动窗口时只会出现一个小的表示故障。通过一些巧妙的信息处理可以克服这一问题。

我知道这真的非常古老,但万一其他人的第一个想法也是屏幕上内置的窗口键盘太小(这也是我的第一个想法),实际上,你可以通过将窗口变大来将其变大(您也可以通过编程方式执行)


+因为我正在制作一个,因为我需要一个能从我的应用程序中更直接地控制它的程序。

谢谢chris,我用一个有效的代码编辑了我的问题,只是我不确定如何提取键盘敲击并使它们显示在一个文本框中。谢谢,不介意!!我修复了这个问题问题……我只是把焦点放在文本框上了!!对不起!谢谢!我会给你+1的答案。但是我看不到我的+1的问题:(哈哈,我在做之前不小心离开了。好了……现在离2000年还有3个:)