重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
建议你这样试试看:
创新互联建站自2013年起,是专业互联网技术服务公司,拥有项目成都网站建设、网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元深州做网站,已为上家服务,为深州各地企业和个人服务,联系电话:028-86922220
做一个下拉框,里边是所有客户可能用到的快捷键集合
当按下按钮时,获取下拉框的按键名称,再将字符串转换Keys枚举,然后进行判断
既然你可以输入英文,只要系统切换到中文输入方式下,例如“谷歌拼音”,不就可以输入中文了
(1)在Form1上布置一个Label,用来显示键盘码
(2)窗体代码如下
Imports System.Windows.Forms
Imports System.IO
Imports System.Net
Imports System.Windows.Forms
Imports System.IO
Imports System.Net
Public Class Form1
Private Sub Form1_Load(sender As Object,
e As EventArgs) Handles MyBase.Load
KeyPreview = True
End Sub
Private Sub Form1_KeyDown(sender As Object,
e As KeyEventArgs) Handles MyBase.KeyDown
Label1.Text = e.KeyValue
End Sub
End Class
按键盘上的键,Label1将显示对应键的键盘码
.net框架就是对API就行封装,做成一个个的类然后可以让你轻松调用,但是。net封装的内容,是常用的内容,有些东西用的时候,还是需要调用API函数,自己写,毕竟,微软不知道你要用什么函数,所以尽可能的满足用户大众口味而已。如果你需要用的比较复杂,还是调用API自己写类吧。
希望我的回答对您有所帮助
Public Class Form2
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
AddHandler Label1.MouseEnter, AddressOf LabelMouseEnter
AddHandler Label2.MouseEnter, AddressOf LabelMouseEnter
AddHandler Label1.MouseLeave, AddressOf LabelMouseLeave
AddHandler Label2.MouseLeave, AddressOf LabelMouseLeave
AddHandler Label1.MouseDown, AddressOf LabelMouseDown
AddHandler Label2.MouseDown, AddressOf LabelMouseDown
End Sub
Private Sub LabelMouseEnter(ByVal sender As Object, ByVal e As System.EventArgs)
Dim c As Label = DirectCast(sender, Label)
c.BackColor = Color.DodgerBlue
End Sub
Private Sub LabelMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Dim c As Label = DirectCast(sender, Label)
Form1.TextBox1.Text = c.Text
End Sub
Private Sub LabelMouseLeave(ByVal sender As Object, ByVal e As System.EventArgs)
Dim c As Label = DirectCast(sender, Label)
c.BackColor = SystemColors.Control
End Sub
End Class