实用宏--vc++中方便注释

实用宏--vc++中方便注释

    '添加文件头定义
    Public Sub AddFileHead()

        Dim objTextSelection As TextSelection
        Dim comment As String
        objTextSelection = CType(DTE.ActiveDocument.Selection, EnvDTE.TextSelection)
        'objTextSelection.LineUp()
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "//==================================================================="
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "/** \file"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*  Filename: " + DTE.ActiveDocument.Name
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*  Desc:"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*  His:      Ipedo create @ " + Date.Now
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*/"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "//==================================================================="

    End Sub
    '添加文件函数定义
    Public Sub AddFunctionHead()

        Dim objTextSelection As TextSelection
        Dim comment As String
        objTextSelection = CType(DTE.ActiveDocument.Selection, EnvDTE.TextSelection)
        'objTextSelection.LineUp()
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "/** \brief"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + " " + "* 函数功能:"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "* 函数说明:"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "* \param  _f1   第一个浮点参数."
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "* \param  _f2   第二个浮点参数."
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "* \return  bool   返回两个浮点数是否相等.返回true时表示相等."
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "* 算法描述:"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "* (描述内容)"
        objTextSelection.NewLine()
        objTextSelection.Text = comment + "*/"

    End Sub

    Sub 文件注释()
        DTE.ActiveDocument.Selection.Text = "//==================================================================="
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "/** \file  "
        DTE.ActiveDocument.Selection.NewLine()
        'DTE.ActiveDocument.Selection.Indent()
        DTE.ActiveDocument.Selection.Text = "* Filename :   " + DTE.ActiveDocument.Name
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "* Desc     :   "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "* His      :   Windy create @" + Date.Now
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.DeleteLeft()
        DTE.ActiveDocument.Selection.Text = "*/"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text = "//==================================================================="
        DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
    End Sub

你可能感兴趣的:(实用宏--vc++中方便注释)