现在的位置: 首页 > 综合 > 正文

VS.Net 的Macros是一个好东西,

2013年02月03日 ⁄ 综合 ⁄ 共 1925字 ⁄ 字号 评论关闭
这几天试着写Macros感觉非常有意思,你要写文档注解,你就可以写成一个MACEOS这个快多了,
  Sub 注解()
        DTE.ActiveDocument.Selection.Text 
= "//************************** "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  名  称: "
        DTE.ActiveDocument.Selection.Text = DTE.ActiveDocument.ProjectItem().Document.Name().Substring(0, DTE.ActiveDocument.ProjectItem().Document.Name().Length - 3)
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  版  本:V1.00 "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  版    权:星际(杭州)网络有限公司"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  程序设计: WangYJ"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  开发日期:"
        DTE.ActiveDocument.Selection.Text = System.DateTime.Now.ToString()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  修 改 人:"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  修改日期:"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//************************* "
    End Sub

    
Sub Modify()
        DTE.ActiveDocument.Selection.Text 
= "//*************    修改  ************* "
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  修改目的:"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  修 改 人:WANGYJ"
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*  修改日期:"
        DTE.ActiveDocument.Selection.Text = System.DateTime.Now.ToString()
        DTE.ActiveDocument.Selection.NewLine()
        DTE.ActiveDocument.Selection.Text 
= "//*********************************** "
    End Sub

不过,感觉有点不好的是,函数功能没有提示,语言就是VB的语法。

抱歉!评论已关闭.