• 通过宏的方式添加头文件注释


    1.打开菜单栏“工具”-->选择"宏"-->"Macro资源管理器"

    2.新建宏项目。选择"Modle1"在其中输入如下宏命令即可。

    Public Module HeadNote

    Sub DocumentFileHeader()
    Dim doc As Document
    Dim docName As String
    Dim companyName As String = "Your company name"
    Dim authorName As String = "Your name"
    Dim copyrightText As String = String.Format("Copyright (c) {0} {1}. All rights reserved.", Date.Now.Year, companyName)

    ' Get the name of this object from the file name
    doc = DTE.ActiveDocument

    ' Get the name of the current document
    docName = doc.Name

    ' Set selection to top of document
    DTE.ActiveDocument.Selection.StartOfDocument()

    ' Write copyright tag
    DTE.ActiveDocument.Selection.Text = "/*"
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* =============================================================================="
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "*"
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* Filename: " + docName
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* Description: "
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "*"

    ' Write author name tag (optional)
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* Version: 1.0"
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* Created: " + String.Format("{0:d}", Date.Now) + " " + String.Format("{0}:{1}:{2}", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* Compiler: Visual Studio 2010"
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "*"
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* Author: " + authorName
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* Company: " + companyName
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "*"
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "* =============================================================================="
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "*/"
    DTE.ActiveDocument.Selection.NewLine()
    End Sub

    End Module

    3.该方法在用于C#文件中时会出现问题。在c++.net 即c++文件中测试通过。

  • 相关阅读:
    如何将网格式报表打印成其它样式
    拥有与实力不相称的脾气是种灾难——北漂18年(23)
    8.8.1 Optimizing Queries with EXPLAIN
    mysql 没有rowid 怎么实现根据rowid回表呢?
    secondary index
    8.5.5 Bulk Data Loading for InnoDB Tables 批量数据加载
    mysql 中key 指的是索引
    8.5.4 Optimizing InnoDB Redo Logging 优化InnoDB Redo 日志
    8.5.3 Optimizing InnoDB Read-Only Transactions 优化InnoDB 只读事务
    8.5.1 Optimizing Storage Layout for InnoDB Tables InnoDB表的存储布局优化
  • 原文地址:https://www.cnblogs.com/sunleinote/p/2635493.html
Copyright © 2020-2023  润新知