vb.net键键值 vb键盘按键代码

vb.net怎么设置快捷键新建一个Form1把Form1的KeyPreview改成True
拖入一个Button1到Form1上面
然后加入以下代码
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyData = https://www.04ip.com/post/(Keys.Alt Or Keys.G) Then
Button1.PerformClick() '或者用Button1_Click(Nothing, New EventArgs)
'快捷键Alt+G触发Button1_Click()事件 。
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Size = New Size(180, 23)
Button1.Text = "我被局部快捷键给召唤了~"
End Sub
“+=”、“-”、“/”和“\”键的keycode值 vb.net WPFkey.oem开头vb.net键键值 , 后面vb.net键键值的vb.net键键值你自己找吧 。
private void Window_KeyDown(object sender, KeyEventArgs e)
{
MessageBox.Show(e.Key.ToString());
}
如何用VB.NET设置菜单项的热键不清楚热键和快捷键是什么区别
1.如果你是指Chrl+S这样vb.net键键值的快捷键vb.net键键值,可以设置ShortCutKeys属性,属性窗口就有可视化编辑器 。
2.如果你是指"保存(S)",其中s有下划线这样的用Alt+字母来访问的设置,应该在菜单项的Text属性中使用符号 。符号后面的字母将被作为快速访问字符,显示的时候不会被显示出来 , 而字母会自动加上下划线 。比如"保存(s)" 。
3.和选中标记有关的属性有两个
CheckOnClick在菜单项上单击时是否改变Checked属性
Checked设置/获取 菜单项是否被选中
4.设置菜单项的Enabled属性为False
VB.NET怎么删除INI文件里的一个字段或键值?1,对于INI文件,可以当做像TXT文件一样来进行读取和写入 。
2,先把整个文件度出来,然后找到相应行删除(抛弃)以后 , 再重新写入文件 。
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyStr As String = ""
Dim AllStr As String = ""
'获取一个可用的文件号
Dim MyFileNum As Integer = FreeFile()
'打开指定的文件 , 进行读取操作
FileOpen(MyFileNum, "C:\My.ini", OpenMode.Input)
Do While Not EOF(MyFileNum)
'读取一行
MyStr = LineInput(MyFileNum)
If MyStr"b=2" Then
If AllStr = "" Then
AllStr = AllStrMyStr
Else
AllStr = AllStrvbCrLfMyStr
End If
End If
Loop
FileClose(MyFileNum)'关闭文件
'写文件
Dim MyStream As New System.IO.FileStream("C:\My.ini", IO.FileMode.Create)
Dim MyWriter As New System.IO.StreamWriter(MyStream, System.Text.Encoding.UTF8)
MyWriter.WriteLine(AllStr)
MyWriter.Flush()
MyWriter.Close()
MyStream.Close()
End Sub
End Class
如何使用VB.net检测某个注册表键值是否存在Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByRef lpData As Any, ByRef lpcbData As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, ByRef phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Const HKEY_LOCAL_MACHINEAs Long = H80000002
Private Sub Command1_Click()
'获取注册表启动项
Dim hKey As Long, ret As Long, Name As String
Name = String(256, Chr(0))
ret = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", hKey)'路径
ret = RegQueryValueEx(hKey, "MyApp", 0, 1, ByVal Name, Len(Name))'项的名称
RegCloseKey hKey
'修改注册表
If ret0 Then
Set w = CreateObject("wscript.shell")

推荐阅读