vs2010 仿XCode风格的头注释宏

Sub DocumentFileHeader()

Dim star As String
star = "//******************************************************************************"

' 将添加焦点定位在文件首部
DTE.ActiveDocument.Selection.StartOfDocument()

' 添加一个版权说明
'DTE.ActiveDocument.Selection.Text = star
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// "
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// " + DTE.ActiveDocument.Name
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// "
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// " + String.Format("Created by {0} on {1:D}.", "***", Date.Now.ToString("yy-MM-dd"))
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// " + String.Format("Copyright (c) {0}年 {1}. All rights reserved.", Date.Now.Year,"***")
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "// "
DTE.ActiveDocument.Selection.NewLine()
'DTE.ActiveDocument.Selection.Text = star
DTE.ActiveDocument.Selection.NewLine()
End Sub

posted @ 2014-03-21 15:12  Reinhard_Hsu  阅读(245)  评论(0编辑  收藏  举报