列出VisualStudio2010所有快捷键的宏命令

6 篇文章 0 订阅
2 篇文章 0 订阅
列出当前键盘快捷键映射
1.在“工具”菜单上指向“宏”,再单击“宏 IDE”。

2.在“项目资源管理器”中双击“MyMacros”。

3.右击“Module1”,再单击“重命名”。

4.键入 KeyboardShortcuts 作为模块的新名称。

5.双击“KeyboardShortcuts”可在编辑器中打开该文件。

6.将下面的代码粘贴到文件中 Public Module KeyboardShortcuts 之后:

Sub GetAllCommands()

Dim cmd As Command
Dim ow As OutputWindow = DTE.Windows.Item(Constants.vsWindowKindOutput).Object
Dim owp As OutputWindowPane
Dim exists As Boolean
Dim i As Integer
Dim sArray() As String

sArray = New String() {}
i = 1
exists = False

For Each owp In ow.OutputWindowPanes
If owp.Name = "Macro Output" Then
exists = True
Exit For
End If
i = i + 1
Next

If exists Then
owp = ow.OutputWindowPanes.Item(i)
Else
owp = ow.OutputWindowPanes.Add("Macro Output")
End If

owp.Clear()

' Output 1 line per command
For Each cmd In DTE.Commands
Dim binding As Object
Dim shortcuts As String
shortcuts = ""

For Each binding In cmd.Bindings
Dim b As String
b = binding
If Not shortcuts = "" Then
shortcuts += "--OR-- "
End If
shortcuts = shortcuts + b + " "
Next

shortcuts = shortcuts.Trim()

If Not cmd.Name.Trim().Equals("") And Not shortcuts.Equals("") Then
sArray.Resize(sArray, sArray.Length + 1)
sArray(sArray.Length - 1) = cmd.Name + vbTab + shortcuts
End If
Next

Array.Sort(sArray)
owp.OutputString(String.Join(vbCrLf, sArray))

End Sub

 7.在“文件”菜单上,单击“保存 MyMacros”。

8.切换回 Visual Studio。

9.在“工具”菜单上指向“宏”,再单击“Macro 资源管理器”。

10.展开“MyMacros”,再展开“KeyboardShortcuts”。

11.右击“GetAllCommands”,再单击“运行”。

该宏生成一个列表,列出 IDE 中所有可能的命令以及这些命令在当前键盘映射方案下所具有的所有键盘快捷键映射。

12.在“视图”菜单上,单击“输出”。

命令及其快捷组合键将显示在“输出”窗口中。 您可以复制此信息,并将其粘贴到另一个应用程序(如 Microsoft Office Excel)中,用于其他格式设置和打印选项。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值