• [Tip: Visual Studio]创建键盘快捷方式速查表


    创建键盘快捷方式速查表。

    大部分开发人员都不了解这一点,但实际上,Visual Studio 默认提供了 450 多个键盘快捷方式。不过,对于如何找到 Visual Studio 内部的所有键盘快捷方式还没有简便的方法。您可以编写一个简单的宏,对于所有默认键盘快捷方式进行遍历,找到它们所对应的操作。以下内容(列表 1)列出了这个宏的代码。

    Public Module Module1
          Public Sub ListShortcutsInHTML()
              'Declare a StreamWriter
            Dim sw As System.IO.StreamWriter
            sw = New System.IO.StreamWriter("c:\\Shortcuts.html", True, System.Text.Encoding.GetEncoding("SHIFT-JIS"))
              'Write the beginning HTML
            WriteHTMLStart(sw)
              ' Add a row for each keyboard shortcut
            For Each c As EnvDTE.Command In DTE.Commands
                If c.Name <> "" Then
                    Dim bindings As System.Array
                    bindings = CType(c.Bindings, System.Array)
                    For i As Integer = 0 To bindings.Length - 1
                        sw.WriteLine("<tr>")
                        sw.WriteLine("<td>" + c.Name + "</td>")
                        sw.WriteLine("<td>" + bindings(i) + "</td>")
                        sw.WriteLine("</tr>")
                    Next
                  End If
            Next
              'Write the end HTML
            WriteHTMLEnd(sw)
              'Flush and close the stream
            sw.Flush()
            sw.Close()
        End Sub
        Public Sub WriteHTMLStart(ByVal sw As System.IO.StreamWriter)
            sw.WriteLine("<html>")
            sw.WriteLine("<head>")
            sw.WriteLine("<title>")
              sw.WriteLine("Visual Studio Keyboard Shortcuts")
            sw.WriteLine("</title>")
            sw.WriteLine("</head>")
              sw.WriteLine("<body>")
            sw.WriteLine("<h1>Visual Studio 2005 Keyboard Shortcuts</h1>")
            sw.WriteLine("<font size=""2"" face=""Verdana"">")
            sw.WriteLine("<table border=""1"">")
            sw.WriteLine("<tr BGCOLOR=""#018FFF""><td align=""center""><b>Command</b></td><td align=""center""><b>Shortcut</b></td></tr>")
          End Sub
          Public Sub WriteHTMLEnd(ByVal sw As System.IO.StreamWriter)
            sw.WriteLine("</table>")
            sw.WriteLine("</font>")
            sw.WriteLine("</body>")
            sw.WriteLine("</html>")
        End Sub
    End Module
     

    列表 1. 在 HTML 文件中生成键盘快捷方式的宏

    要使用这个宏,请转到“工具”,选择“宏”,然后选择“宏 IDE. . .”启动“宏 IDE”。展开 MyMacros 工程,MyMacros 命名空间,然后双击“Module1”。将列表 1 中的内容复制到“宏 IDE”然后运行宏即可。运行宏之后,将会生成 Visual Studio 的键盘快捷方式参考信息。打开包含输出内容的 C:\demo\Shortcuts.html 文件。“图 1”显示了部分输出内容。如果方便就将它打印出来,贴在计算机附近,以便学习新的键盘快捷方式。

  • 相关阅读:
    String comparison is too slow in R language
    R语言之正则表达式
    Java日期时间(Date/Time)
    Java 字符串拆分(拆分字符串)
    vue总是报缩进、空格的错
    解决在Vue项目中时常因为代码缩进导致页面报错的问题
    Cordova+Vue快速搭建Hybrid App
    npm i和npm install的区别
    hybrid cordova+vue开发APP(一) 环境搭建
    vue-cli中理不清的assetsSubDirectory 和 assetsPublicPath
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1666728.html
Copyright © 2020-2023  润新知