vs2008快捷键生成

 1:  Imports System
 2:  Imports EnvDTE
 3:  Imports EnvDTE80
 4:  Imports EnvDTE90
 5:  Imports System.Diagnostics
 6:  Imports System.IO
 7:   
 8:   
 9:  Public Module Module1
10:      Public Sub ListShortcutsInHTML()
11:          'Declare a StreamWriter
12:          Dim sw As System.IO.StreamWriter
13:          sw = New StreamWriter("d:\\Shortcuts.html")
14:   
15:          'Write the beginning HTML
16:          WriteHTMLStart(sw)
17:   
18:          ' Add a row for each keyboard shortcut
19:          For Each c As Command In DTE.Commands
20:              If c.Name <> "" Then
21:                  Dim bindings As System.Array
22:                  bindings = CType(c.Bindings, System.Array)
23:                  For i As Integer = 0 To bindings.Length - 1
24:                      sw.WriteLine("<tr>")
25:                      sw.WriteLine("<td>" + c.Name + "</td>")
26:                      sw.WriteLine("<td>" + bindings(i) + "</td>")
27:                      sw.WriteLine("</tr>")
28:                  Next
29:  
30:              End If
31:          Next
32:  
33:          'Write the end HTML
34:          WriteHTMLEnd(sw)
35:   
36:          'Flush and close the stream
37:          sw.Flush()
38:          sw.Close()
39:   
40:      End Sub
41:  
42:      'Declare a StreamWriter
43:  
44:      Public Sub WriteHTMLStart(ByVal sw As System.IO.StreamWriter)
45:          sw.WriteLine("<html>")
46:          sw.WriteLine("<head>")
47:          sw.WriteLine("<title>")
48:   
49:          sw.WriteLine("Visual Studio Keyboard Shortcuts")
50:          sw.WriteLine("</title>")
51:          sw.WriteLine("</head>")
52:   
53:          sw.WriteLine("<body>")
54:          sw.WriteLine("<h1>Visual Studio 2005 Keyboard Shortcuts</h1>")
55:          sw.WriteLine("<font size=""2"" face=""Verdana"">")
56:          sw.WriteLine("<table border=""1"">")
57:          sw.WriteLine("<tr BGCOLOR=""#018FFF""><td align=""center""><b>Command</b></td><tdalign=""center""><b>Shortcut</b></td></tr>")
58:   
59:   
60:      End Sub
61:  
62:      Public Sub WriteHTMLEnd(ByVal sw As System.IO.StreamWriter)
63:          sw.WriteLine("</table>")
64:          sw.WriteLine("</font>")
65:          sw.WriteLine("</body>")
66:          sw.WriteLine("</html>")
67:      End Sub
68:  
69:  End Module
70:  
71:  
Bookmark and Share
posted @ 2010-02-10 21:48  cdboy  阅读(465)  评论(5编辑  收藏  举报