VS中为函数自动添加函数说明

步骤:

1、在记事本中编辑好类似下面的脚本代码:

01    Imports System
02	Imports EnvDTE
03	Imports EnvDTE80
04	Imports EnvDTE90
05	Imports EnvDTE90a
06	Imports EnvDTE100
07	Imports System.Diagnostics
08	  
09	Public Module ModuleTop
10	    Sub AddFunComment()
11	        Dim DocSel As EnvDTE.TextSelection
12	        DocSel = DTE.ActiveDocument.Selection
13	        DocSel.NewLine()
14	        DocSel.Text = "/*******************************************************************"
15	        DocSel.NewLine()
16	        DocSel.Text = "* 版权所有: "
17	        DocSel.NewLine()
18	        DocSel.Text = "* 类 名 称: "
19	        DocSel.NewLine()
20	        DocSel.Text = "* 功    能: "
21	        DocSel.NewLine()
22	        DocSel.Text = "* 参    数: "
23	        DocSel.NewLine()
24	        DocSel.Text = "* 返 回 值: "
25	        DocSel.NewLine()
26	        DocSel.Text = "* 作    者:XXXXX"
27	        DocSel.NewLine()
28	        DocSel.Text = "* 电子邮箱:XXXXXX@gmail.com"
29	        DocSel.NewLine()
30	        DocSel.Text = "* 创建日期: " + System.DateTime.Now.ToString()
31	        DocSel.NewLine()
32	        DocSel.Text = "*******************************************************************/"
33	    End Sub
34	  
35	End Module
2、VS2010 IDE -> 工具 -> 宏 -> 新建宏项目,选择要保存的位置。然后将要上面的脚本复制进去,保存即可。


3、为你编写的宏绑定快捷键,VS2005 IDE -> 工具 -> 选项 -> 在左边列表中选择“键盘” -> 在右边的“显示命令包含”中,选择你创建宏-> 将光标定位到”按快捷键”处 -> 输入你想命名的快捷键,比如”Alt+C”,保存即可。



注:类内部注释


Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
 
Public Module ModuleContent
    Sub AddFunComment()
        Dim DocSel As EnvDTE.TextSelection
        DocSel = DTE.ActiveDocument.Selection
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = " #region<构造方法和析构方法>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#endregion<构造方法和析构方法>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#region<常量>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#endregion<常量>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#region<变量>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#endregion<变量>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#region<属性>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#endregion<属性>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#region<方法>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#endregion<方法>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#region<事件>"
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#endregion<事件>"
    End Sub
 
End Module
其余步骤同上。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值