winform中,当点击textbox弹出一个软键盘,请问要做么做,最好有代码。

 我来答
jeffery1514
推荐于2016-11-04
知道答主
回答量:11
采纳率:0%
帮助的人:12.4万
展开全部
度娘查下键盘勾子,有很多Demo

public static string KeyBoard = "是";
public static void In_SystermInfo()
{

try
{
KeyBoard = "是";// dt.Select("kye = 'Keyboard'")[0]["kyevalue"].ToString();
} catch { KeyBoard = "是"; }
KeyBoard = "是";

}
#region 虚拟键盘是否启用
public static void IsKeyBoard(System.Windows.Forms.Form frm, string kb)
{
if (kb.Trim() == "是")
{
foreach (System.Windows.Forms.Control c in frm.Controls)
{
if (c is HookExLib.DataGridViewX)
{
((HookExLib.DataGridViewX)c).Keyboard = true;
}
if (c is HookExLib.TextBoxX)
{
((HookExLib.TextBoxX)c).Keyboard = true;
}
if (c is System.Windows.Forms.ToolStrip)
{
foreach (System.Windows.Forms.ToolStripItem ti in ((System.Windows.Forms.ToolStrip)c).Items)
{
if (ti is HookExLib.toolStripTextBoxX)
{
((HookExLib.toolStripTextBoxX)ti).Keyboard = true;
}
}
}
if (c.HasChildren)
{
HasControl(c, true);
}
}
}
if (kb.Trim() == "否")
{
foreach (System.Windows.Forms.Control c in frm.Controls)
{
if (c is HookExLib.DataGridViewX)
{
((HookExLib.DataGridViewX)c).Keyboard = false;
}
if (c is HookExLib.TextBoxX)
{
((HookExLib.TextBoxX)c).Keyboard = false;
}
if (c is System.Windows.Forms.ToolStrip)
{
foreach (System.Windows.Forms.ToolStripItem ti in ((System.Windows.Forms.ToolStrip)c).Items)
{
if (ti is HookExLib.toolStripTextBoxX)
{
((HookExLib.toolStripTextBoxX)ti).Keyboard = false;
}
}
}
if (c.HasChildren)
{
HasControl(c, false);
}
}
}
}
public static void HasControl(System.Windows.Forms.Control has, bool tof)
{
foreach (System.Windows.Forms.Control c in has.Controls)
{
if (c is HookExLib.DataGridViewX)
{
((HookExLib.DataGridViewX)c).Keyboard = tof;
}
if (c is HookExLib.TextBoxX)
{
((HookExLib.TextBoxX)c).Keyboard = tof;
}
if (c is System.Windows.Forms.ToolStrip)
{
foreach (System.Windows.Forms.ToolStripItem ti in ((System.Windows.Forms.ToolStrip)c).Items)
{
if (ti is HookExLib.toolStripTextBoxX)
{
((HookExLib.toolStripTextBoxX)ti).Keyboard = tof;
}
}
}
if (c.HasChildren)
{
HasControl(c, tof);
}
}
}
#endregion
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式