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

来源:互联网 发布:淘宝折扣卷 编辑:程序博客网 时间:2024/05/21 19:38

步骤:

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

01    Imports System02Imports EnvDTE03Imports EnvDTE8004Imports EnvDTE9005Imports EnvDTE90a06Imports EnvDTE10007Imports System.Diagnostics08  09Public Module ModuleTop10    Sub AddFunComment()11        Dim DocSel As EnvDTE.TextSelection12        DocSel = DTE.ActiveDocument.Selection13        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 Sub34  35End Module
2、VS2010 IDE -> 工具 -> 宏 -> 新建宏项目,选择要保存的位置。然后将要上面的脚本复制进去,保存即可。


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



注:类内部注释


Imports SystemImports EnvDTEImports EnvDTE80Imports EnvDTE90Imports EnvDTE90aImports EnvDTE100Imports 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 0
原创粉丝点击