在form1 里面有好多textbox,当我点击任意一个textbox时,这个小键盘就会弹出,
键盘上面有0-9数字,还左、右移,回车,删除,点,空格 ,上面有一个textbox,
用来点击数字时,通过这个textbox 传到form1里面的当前输入textbox里面,谁会
求高手帮助,多谢!
14 个解决方案
#1
哥哥,做一个窗口不就好了吗?这个是什么意思?
#2
用两个窗体是能实现,但我想用一个窗体,键盘这个不用,用什么控件 可以实现吗?、
#3
'剩余的自己去完善吧
Public Class Form2
Private btn As ButtonDef
Private btnText = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
".", "Del", "Left", "Right", "Enter", "Space"}
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 0 To 15
Dim x = If((i + 1) Mod 3 = 0, 3, (i + 1) Mod 3)
Dim y = If((i + 1) Mod 3 = 0, (i + 1) \ 3 - 1, (i + 1) \ 3)
btn(i) = New Button With
{
.Name = "btn_" & i.ToString(0),
.Text = btnText(i),
.Location = New Point(x * 48 - 46, y * 26 + 2),
.Size = New Size(If(.Text <> "Space", 46, 48 * 3 - 2), 24)
}
AddHandler btn(i).Click, AddressOf btn_Click
Me.Controls.Add(btn(i))
Next
End Sub
Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
With btn
Form1.Activate()
Select Case TryCast(sender, Button).Name
Case .Num0.Name, .Num1.Name, .Num2.Name, .Num3.Name, .Num4.Name,
.Num5.Name, .Num6.Name, .Num7.Name, .Num8.Name, .Num9.Name, .Dot.Name
SendKeys.Send(TryCast(sender, Button).Text)
Case .Left.Name, .Right.Name, .Del.Name, .Enter.Name
SendKeys.Send("{" & TryCast(sender, Button).Text & "}")
Case .Space.Name
SendKeys.Send(" ")
Case Else
End Select
End With
End Sub
End Class
Public Structure ButtonDef
Default Public Property Index(ByVal idx As Integer) As Button
Get
Select Case idx
Case 0 : Return Num0
Case 1 : Return Num1
Case 2 : Return Num2
Case 3 : Return Num3
Case 4 : Return Num4
Case 5 : Return Num5
Case 6 : Return Num6
Case 7 : Return Num7
Case 8 : Return Num8
Case 9 : Return Num9
Case 10 : Return Dot
Case 11 : Return Del
Case 12 : Return Left
Case 13 : Return Right
Case 14 : Return Enter
Case 15 : Return Space
Case Else : Return Nothing
End Select
End Get
Set(ByVal value As Button)
Select Case idx
Case 0 : Num0 = value
Case 1 : Num1 = value
Case 2 : Num2 = value
Case 3 : Num3 = value
Case 4 : Num4 = value
Case 5 : Num5 = value
Case 6 : Num6 = value
Case 7 : Num7 = value
Case 8 : Num8 = value
Case 9 : Num9 = value
Case 10 : Dot = value
Case 11 : Del = value
Case 12 : Left = value
Case 13 : Right = value
Case 14 : Enter = value
Case 15 : Space = value
End Select
End Set
End Property
Public Num0, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9 As Button
Public Left, Right, Enter, Space, Dot, Del As Button
End Structure
#4
#5
楼上,当用鼠标按键时,焦点位置不是发生变化了吗? 哪句代码是实现把光标停留在textbox啊?
#6
TextBox1.Select就可以将焦点传回给textbox控件,自己设定。
#7
调用系统软键盘
#8
非常感谢大家!!!
#9
Private btnText = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "Del", "Left", "Right", "Enter", "Space"}
btn(i) = New Button With { .Name = "btn_" & i.ToString(0), .Text = btnText(i), .Location = New Point(x * 48 - 46, y * 26 + 2), .Size = New Size(If(.Text <> "Space", 46, 48 * 3 - 2), 24) }
这两段通不过。
btn(i) = New Button With { .Name = "btn_" & i.ToString(0), .Text = btnText(i), .Location = New Point(x * 48 - 46, y * 26 + 2), .Size = New Size(If(.Text <> "Space", 46, 48 * 3 - 2), 24) }
这两段通不过。
#10
大家有没有实例,触摸屏上的带躲避功能的数字键盘,发到我的邮箱:glove_0924@sina.com
不胜感谢!
不胜感谢!
#11
我用的Visual Basic 2012
#12
挖好好厉害啊 都是高手
#13
焦点问题还没解决?有谁再指点一下。
当我在form1里的方本输入数字的同时,弹出模拟数字键盘form2窗体,当我按数字键时,
让form1j里面的当前文体获得焦点。
当我在form1里的方本输入数字的同时,弹出模拟数字键盘form2窗体,当我按数字键时,
让form1j里面的当前文体获得焦点。
#14
學習,以後系統會用到的。
#1
哥哥,做一个窗口不就好了吗?这个是什么意思?
#2
用两个窗体是能实现,但我想用一个窗体,键盘这个不用,用什么控件 可以实现吗?、
#3
'剩余的自己去完善吧
Public Class Form2
Private btn As ButtonDef
Private btnText = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
".", "Del", "Left", "Right", "Enter", "Space"}
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 0 To 15
Dim x = If((i + 1) Mod 3 = 0, 3, (i + 1) Mod 3)
Dim y = If((i + 1) Mod 3 = 0, (i + 1) \ 3 - 1, (i + 1) \ 3)
btn(i) = New Button With
{
.Name = "btn_" & i.ToString(0),
.Text = btnText(i),
.Location = New Point(x * 48 - 46, y * 26 + 2),
.Size = New Size(If(.Text <> "Space", 46, 48 * 3 - 2), 24)
}
AddHandler btn(i).Click, AddressOf btn_Click
Me.Controls.Add(btn(i))
Next
End Sub
Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
With btn
Form1.Activate()
Select Case TryCast(sender, Button).Name
Case .Num0.Name, .Num1.Name, .Num2.Name, .Num3.Name, .Num4.Name,
.Num5.Name, .Num6.Name, .Num7.Name, .Num8.Name, .Num9.Name, .Dot.Name
SendKeys.Send(TryCast(sender, Button).Text)
Case .Left.Name, .Right.Name, .Del.Name, .Enter.Name
SendKeys.Send("{" & TryCast(sender, Button).Text & "}")
Case .Space.Name
SendKeys.Send(" ")
Case Else
End Select
End With
End Sub
End Class
Public Structure ButtonDef
Default Public Property Index(ByVal idx As Integer) As Button
Get
Select Case idx
Case 0 : Return Num0
Case 1 : Return Num1
Case 2 : Return Num2
Case 3 : Return Num3
Case 4 : Return Num4
Case 5 : Return Num5
Case 6 : Return Num6
Case 7 : Return Num7
Case 8 : Return Num8
Case 9 : Return Num9
Case 10 : Return Dot
Case 11 : Return Del
Case 12 : Return Left
Case 13 : Return Right
Case 14 : Return Enter
Case 15 : Return Space
Case Else : Return Nothing
End Select
End Get
Set(ByVal value As Button)
Select Case idx
Case 0 : Num0 = value
Case 1 : Num1 = value
Case 2 : Num2 = value
Case 3 : Num3 = value
Case 4 : Num4 = value
Case 5 : Num5 = value
Case 6 : Num6 = value
Case 7 : Num7 = value
Case 8 : Num8 = value
Case 9 : Num9 = value
Case 10 : Dot = value
Case 11 : Del = value
Case 12 : Left = value
Case 13 : Right = value
Case 14 : Enter = value
Case 15 : Space = value
End Select
End Set
End Property
Public Num0, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9 As Button
Public Left, Right, Enter, Space, Dot, Del As Button
End Structure
#4
#5
楼上,当用鼠标按键时,焦点位置不是发生变化了吗? 哪句代码是实现把光标停留在textbox啊?
#6
TextBox1.Select就可以将焦点传回给textbox控件,自己设定。
#7
调用系统软键盘
#8
非常感谢大家!!!
#9
Private btnText = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "Del", "Left", "Right", "Enter", "Space"}
btn(i) = New Button With { .Name = "btn_" & i.ToString(0), .Text = btnText(i), .Location = New Point(x * 48 - 46, y * 26 + 2), .Size = New Size(If(.Text <> "Space", 46, 48 * 3 - 2), 24) }
这两段通不过。
btn(i) = New Button With { .Name = "btn_" & i.ToString(0), .Text = btnText(i), .Location = New Point(x * 48 - 46, y * 26 + 2), .Size = New Size(If(.Text <> "Space", 46, 48 * 3 - 2), 24) }
这两段通不过。
#10
大家有没有实例,触摸屏上的带躲避功能的数字键盘,发到我的邮箱:glove_0924@sina.com
不胜感谢!
不胜感谢!
#11
我用的Visual Basic 2012
#12
挖好好厉害啊 都是高手
#13
焦点问题还没解决?有谁再指点一下。
当我在form1里的方本输入数字的同时,弹出模拟数字键盘form2窗体,当我按数字键时,
让form1j里面的当前文体获得焦点。
当我在form1里的方本输入数字的同时,弹出模拟数字键盘form2窗体,当我按数字键时,
让form1j里面的当前文体获得焦点。
#14
學習,以後系統會用到的。