189 8069 5689

vb.net组合键,vb中组合框

VB.NET即时窗口快捷键

VB.NET即时窗口用于在设计时调试和计算表达式、执行语句、输出变量值等

成都创新互联2013年开创至今,先为尼泸西等服务建站,尼泸西等地企业,进行企业商务咨询服务。为尼泸西企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

快捷键是:CTRL+G 或者按 CTRL+ALT+I

vb.net 组合键Ctrl+Enter怎样发送

看了很多这方便的解决方案,很多都是一大段代码,版本也有差别,既然有可能别人用得起我也用不起。

我用一种最简单的方法,只要思路对所有人都能用得起。

其实非常简单,就是获取键值,Ctrl+Enter的健值是10,是不是思路一下就通了。以下是源码:

Private Sub 聊天输入框_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles 聊天输入框.KeyPress

If Asc(e.KeyChar) = 发送快捷键值 Then

发送消息过程()

End If

End Sub

源内容出处:

vb.net,怎么做全局快捷键??

'vb全局快捷键是个大大滴难题,不好整。以下是个演示,办法比较笨,本人自用的,你试试。

'窗体放上控件:Command1、Label1、Check1、Check2、Text1、Text2、Timer1

'加入以下代码,运行,设置"确定"键的快捷键

'可选"CTRL+某键"或者"SHIFT+某键"

'"某键"自己设置,只能设置为字母或数字

Private Declare Function GetAsyncKeyState Lib "user32" _

(ByVal vKey As Long) As Integer 'API声明

Dim i

'================================================================

'这部分是设置各控件的大小、位置和初始属性,为了便于演示才加的,

'你可以自行设计好各控件的大小、位置和初始属性,无需这些代码。

Private Sub Form_Load()

Form1.Width = 2690: Form1.Height = 2100

Command1.Width = 1215: Command1.Height = 495

Command1.Top = 120: Command1.Left = 120

Command1.Caption = "确定"

Label1.Width = 2175: Label1.Height = 255

Label1.Top = 720: Label1.Left = 120

Label1.Caption = "设置 确定 键的快捷键:"

Check1.Width = 975: Check1.Height = 255

Check1.Top = 960: Check1.Left = 120

Check1.Caption = "CTRL +"

Check2.Width = 975: Check2.Height = 255

Check2.Top = 1320: Check2.Left = 120

Check2.Caption = "SHIFT +"

Text1.Width = 255: Text1.Height = 270

Text1.Top = 960: Text1.Left = 1080

Text1.Text = ""

Text2.Width = 255: Text2.Height = 270

Text2.Top = 1320: Text2.Left = 1080

Text2.Text = ""

Timer1.Interval = 10 'Timer的属性,必须设置

End Sub

'以上部分是设置各控件的大小、位置和初始属性,为了便于演示才加的,

'你可以自行设计好各控件的大小、位置和初始属性,无需这些代码。

'================================================================

Private Sub Timer1_Timer()

If Text1 "" Then

If Len(Text1) 1 Then Text1 = Left(Text1, 1)

If Asc("a") = Asc(Text1) And Asc(Text1) = Asc("z") _

Then Text1 = Chr(Asc(Text1) - 32)

If Check1.Value = 1 And GetAsyncKeyState(vbKeyControl) 0 _

And GetAsyncKeyState(Asc(Text1)) 0 Then

i = i + 1

If i = 1 Then Call Command1_Click

Else

i = 0

End If

End If

If Text2 "" Then

If Len(Text2) 1 Then Text2 = Left(Text2, 1)

If Asc("a") = Asc(Text2) And Asc(Text2) = Asc("z") _

Then Text2 = Chr(Asc(Text2) - 32)

If Check2.Value = 1 And GetAsyncKeyState(vbKeyShift) 0 _

And GetAsyncKeyState(Asc(Text2)) 0 Then

i = i + 1

If i = 1 Then Call Command1_Click

Else

i = 0

End If

End If

End Sub

Private Sub Command1_Click()

print "你好"

SendKeys "你好"

End Sub

VB.NET组合键

直接设置貌似不行 可以在窗体的 KeyDown事件里面写Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

MsgBox("快捷键设置成功")

End Sub

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

If e.Shift And e.KeyCode = Keys.C Then

Button1_Click(sender, e)

End If

End Sub

End Class


标题名称:vb.net组合键,vb中组合框
文章源于:http://cdxtjz.cn/article/hedogs.html

其他资讯