.NET 自定义注释格式&快捷注释宏
2010-07-27 17:02
141 查看
1.创建宏
2.编辑宏
3.代码
4.工具-选项-键盘
5.搜索宏
6.宏与事件绑定。
效果:
2.编辑宏
3.代码
Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports System.Diagnostics '///----------------------------------------------------------------- '///<copyright> Copyright (c) 2009,xxx有限公司 All rights reserved.</copyright> '///<summary> '/// KP '///</summary> '///<current_version>1.0.0.1</current_version> '///<author>BLACK</author> '///<finish_date></finish_date> '///<modify>BLACK</modify> '///<modify_date></modify_date> '///----------------------------------------------------------------- Public Module KP Private Function Copyright() Copyright = "Copyright (c) " + CStr(Date.Today.Year) + ",XXXX有限公司 All rights reserved." End Function Private Function EMailAddress() EMailAddress = "XXX@XXX.com" End Function Private Function AuthorName() AuthorName = "XXX" End Function Function ProductName() ProductName = "" End Function Private Function GenGUIDString() As String Dim sGUID As String sGUID = System.Guid.NewGuid.ToString() sGUID = UCase(sGUID.Replace("-", "_")) GenGUIDString = sGUID End Function Private Function FileString(ByVal filename As String) As String FileString = UCase(filename.Replace(".", "_")) UCase(Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 2)) End Function Sub ClassTitleTemplate() Dim lens = 0 Dim strDesc = vbLf + "///------------------------------------------------------------------------------" + vbLf + _ "Copyright:" + Copyright() + vbLf + _ "描 述:" + vbLf + _ "版本号:1.0.0.1" + vbLf + _ "作 者:" + AuthorName() + " (" + EMailAddress() + ")" + vbLf + _ "日 期:" + FormatDateTime(Date.Today, 1) + vbLf + _ "修 改:" + vbLf + _ "原 因:" + vbLf + _ "------------------------------------------------------------------------------" 'ActiveDocument.Selection.StartOfDocument(0) ActiveDocument.Selection.text() = strDesc End Sub '///<current_version>1.0.0.1</current_version> '///<author>xxx</author> '///<finish_date>20100727</finish_date> '///<modify>xxx</modify> '///<modify_date>20100727</modify_date> '///----------------------------------------------------------------- Sub FunctionTitleTemplate() Dim Descr = "///" + "描 述:" + vbLf + _ "作 者:" + AuthorName() + " (" + EMailAddress() + ")" + vbLf + _ "时 间:" + FormatDateTime(Date.Today, 1) + vbLf + _ "修 改:" + vbLf + _ "原 因:" ' ActiveDocument.Selection.StartOfDocument(0) ActiveDocument.Selection.text = Descr End Sub '签名 Private Function Myname() As String Dim Descr = AuthorName() + " (" + EMailAddress() + ")" End Function Private Function Curdate() As String Dim Descr = FormatDateTime(Date.Today, 1) End Function '修改者签名 Sub Modify() Dim Descr = AuthorName() + " (" + EMailAddress() + ")" + " " + FormatDateTime(Date.Today, 1) ActiveDocument.Selection.text = Descr End Sub End Module
4.工具-选项-键盘
5.搜索宏
6.宏与事件绑定。
效果:
/// <summary> /// ------------------------------------------------------------------------------ /// Copyright:Copyright (c) 2010,xxx限公司 All rights reserved. /// 描 述: /// 版本号:1.0.0.1 /// 作 者:xxx (xxx@xxx.com) /// 日 期:2010年7月27日 /// 修 改: /// 原 因: /// ------------------------------------------------------------------------------ /// </summary> public class ConnectDB : DBOBase { #region [私有变量] #endregion
相关文章推荐
- .NET 自定义Json序列化时间格式
- ExtJS Tips->Grid column的自定义格式
- Hadoop & Hadoop Streaming 自定义输出格式
- IOS 封装类的时候注释格式,使用的时候可以想官方库一样快捷显示
- Android Studio 自定义注释&快速输入代码片段
- C#中如何将List<自定义>转为Json格式 及相关函数-DataContractJsonSerializer
- 在.Net如何制作自定义的快捷方式(转)
- 发布首款支持Shift/Ctrl多选的国产日历控件,界面仿Twitter风格,支持中文日期类型,支持SImpleDateFormat格式,支持change等自定义事件,全中文注释和API,欢迎支持
- 一起谈.NET技术,Ajax和WEB服务数据格式:自定义返回格式
- Linux Shell自定义快捷指令
- EA代码工程---轻松几步教你更改"EA生成的源代码表头注释格式"
- 紫辰报表,紫辰友创发布的.net环境下采用Excel格式输出 支持用户自定义格式的报表
- .net在repeater里面自定义格式
- Excel常见神器的另类新解 “条件格式”OR“自定义数字格式”
- .net 自定义快捷菜单
- Excel常见神器的另类新解 “条件格式”OR“自定义数字格式”
- C/C++ VS2012及以上添加 Snippet,自定义快捷输入注释
- 精进不休 .NET 4.0 (2) - asp.net 4.0 新特性之url路由, 自定义CacheProvider, 新增的表达式<%: expression %>, QueryExtender控件, 其它新特性
- IDEA自定义快捷输入注释
- 精进不休 .NET 4.0 (2) - asp.net 4.0 新特性之url路由, 自定义CacheProvider, 新增的表达式<%: expression %>, QueryExtender控