利用VB模拟手机键盘输入
9个command...大致和手机的键盘输入一样...按一个键可以在文本框内输入字母..例如按2键就显示出a.2秒内按第二次则是b.再按则是c.如果两秒内无动作则输入a到...
9个command...大致和手机的键盘输入一样...按一个键可以在文本框内输入字母..例如按2键就显示出a.2秒内按第二次则是b.再按则是c.如果两秒内无动作则输入a到文本框内..像手机输入一样.如果可以就配上简单的说明..因为我是个新手..啥都不懂
展开
4个回答
展开全部
代码测式成功!基本和手机输入相同,timer时间可以自己设置。改变t就可以。一个text 一个timer 一个command (有什么不懂的可以问我)
Dim n
Private Sub Command1_Click()
t = "abc1" '修改改这里“def2”
n = n + 1
If n > Len(t) Then n = 1
If Timer1 = False Then
n = 1
Text1.Text = Text1 & Mid(t, n, 1)
Else
Text1.Text = Mid(Text1, 1, Len(Text1) - 1) & Mid(t, n, 1)
End If
Timer1.Enabled = False
Timer1.Enabled = True
Text1.SetFocus
Text1.SelStart = Len(Text1) - 1
Text1.SelLength = 1
End Sub
Private Sub Timer1_Timer()
Text1.SelStart = Len(Text1)
Text1.SelLength = 0
Timer1.Enabled = False
End Sub
展开全部
Dim Wei As Integer
Private Sub Command1_Click()
If zen = False Then z = Label1.Caption: Wei = 0: Label2.Caption = "正在输入"
zen = True
j = 0
If Wei < 3 Then
Wei = Wei + 1
Else
Wei = 1
End If
s = tt("ABC", Wei)
Label1.Caption = z & s
End Sub
Private Sub Command1_Click()
If zen = False Then z = Label1.Caption: Wei = 0: Label2.Caption = "正在输入"
zen = True
j = 0
If Wei < 3 Then
Wei = Wei + 1
Else
Wei = 1
End If
s = tt("ABC", Wei)
Label1.Caption = z & s
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'窗体里加入label1与label2,一个command1,一个Timer1(时钟控件)
Dim Wei As Integer
Private Sub Command1_Click()
If zen = False Then z = Label1.Caption: Wei = 0: Label2.Caption = "正在输入"
zen = True
j = 0
If Wei < 3 Then
Wei = Wei + 1
Else
Wei = 1
End If
s = tt("ABC", Wei)
Label1.Caption = z & s
End Sub
Private Sub Form_Load()
Timer1.Interval = 1
Label1.AutoSize = True
Label2.AutoSize = True
Label1.Caption = "输入:"
Label2.Caption = "完成"
End Sub
Private Sub Timer1_Timer()
If zen = True Then
j = j + 1
If j = 100 Then
Label1.Caption = z & s
s = ""
zen = False
Label2.Caption = "完成"
End If
End If
End Sub
Private Function tt(text As String, zhi As Integer) As String
tt = Mid("ABC", zhi, 1)
End Function
Dim Wei As Integer
Private Sub Command1_Click()
If zen = False Then z = Label1.Caption: Wei = 0: Label2.Caption = "正在输入"
zen = True
j = 0
If Wei < 3 Then
Wei = Wei + 1
Else
Wei = 1
End If
s = tt("ABC", Wei)
Label1.Caption = z & s
End Sub
Private Sub Form_Load()
Timer1.Interval = 1
Label1.AutoSize = True
Label2.AutoSize = True
Label1.Caption = "输入:"
Label2.Caption = "完成"
End Sub
Private Sub Timer1_Timer()
If zen = True Then
j = j + 1
If j = 100 Then
Label1.Caption = z & s
s = ""
zen = False
Label2.Caption = "完成"
End If
End If
End Sub
Private Function tt(text As String, zhi As Integer) As String
tt = Mid("ABC", zhi, 1)
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这程序用来做什么?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询