VC 6.0 快捷键添加/取消注释
2012-10-12 10:34
423 查看
取消/注释的宏,可以用于C++,java,VB
VC内使用方法:
将文件格式更改为dsm,放置于Program Files/Microsoft Visual Studio/COMMON/MSDev98/Macros目录下
打开VC——Customize——add-ins and Macro files
勾选上Comment,然后选择键盘,类别里选择Macros,CustomCommentOut设置好快捷键就可以了..
VC内使用方法:
将文件格式更改为dsm,放置于Program Files/Microsoft Visual Studio/COMMON/MSDev98/Macros目录下
打开VC——Customize——add-ins and Macro files
勾选上Comment,然后选择键盘,类别里选择Macros,CustomCommentOut设置好快捷键就可以了..
Sub CustomCommentOut() 'DESCRIPTION: 注释/取消注释宏,可处理VB和C++、Java注释 Dim win set win = ActiveWindow If win.type <> "Text" Then MsgBox "This macro can only be run when a text editor window is active." Else TypeOfFile = 3 If TypeOfFile > 0 And TypeOfFile < 6 Then If TypeOfFile > 3 Then CommentType = "'" ' VB注释 CommentWidth = 1 Else CommentType = "//" ' C++、java 注释 CommentWidth = 2 End If StartLine = ActiveDocument.Selection.TopLine EndLine = ActiveDocument.Selection.BottomLine If EndLine < StartLine Then Temp = StartLine StartLine = EndLine EndLine = Temp End If ' 单行 If EndLine = StartLine Then ActiveDocument.Selection.StartOfLine dsFirstColumn ActiveDocument.Selection.CharRight dsExtend, CommentWidth If ActiveDocument.Selection = CommentType Then ActiveDocument.Selection.Delete Else ActiveDocument.Selection.StartOfLine dsFirstText ActiveDocument.Selection.CharRight dsExtend, CommentWidth If ActiveDocument.Selection = CommentType Then ActiveDocument.Selection.CharRight dsExtend ActiveDocument.Selection.Delete Else ActiveDocument.Selection.StartOfLine dsFirstText ActiveDocument.Selection = CommentType + vbTab + _ ActiveDocument.Selection End If End If ' 多行 Else For i = StartLine To EndLine ActiveDocument.Selection.GoToLine i CommentLoc = dsFirstColumn ActiveDocument.Selection.StartOfLine CommentLoc ActiveDocument.Selection.CharRight dsExtend, CommentWidth If ActiveDocument.Selection = CommentType Then ActiveDocument.Selection.Delete Else ActiveDocument.Selection.StartOfLine CommentLoc ActiveDocument.Selection = CommentType + _ ActiveDocument.Selection End If Next End If Else MsgBox("Unable to comment out the highlighted text" + vbLf + _ "because the file type was unrecognized." + vbLf + _ "If the file has not yet been saved, " + vbLf + _ "please save it and try again.") End If End If End Sub
相关文章推荐
- [转]VC 6.0 快捷键添加/取消注释
- VC中为开发环境添加批量注释或取消注释(转)
- 如何在Visual C++ 6.0中添加多行注释图标和多行注释快捷键?
- 3个很有用VC的IDE工具宏:添加函数注释块、注释、取消注释
- VC6自定义注释代码快捷键
- eclipse 快捷键大全,eclipse查找类,文件,添加注释
- VC 6.0 快捷键
- VS2017基础 快捷键 编写css时,添加注释与撤销注释
- VS注释与取消注释快捷键
- Matlab注释多行和取消多行注释的快捷键
- 用VA快速添加注释+快捷键
- Eclipse中添加文档注释快捷键
- 如何在VC++6.0中添加和取消批量注释
- Eclipse中添加文档注释快捷键
- eclipse 快捷键大全,eclipse查找类,文件,添加注释
- vim中块儿代码添加注释和取消注释
- VS注释与取消注释快捷键
- Eclipse和STS中添加文档注释快捷键
- VC++ 6.0 快捷键 及 断点调试方法
- eclipse为方法添加注释的快捷键是什么