日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
利用VisualStudio2008宏實(shí)現(xiàn)自動(dòng)注釋

1. 在Tool中選擇Macros,打開Macro IDE

2. 在MyMacros 刪除默認(rèn)文件 Module1.vb,添加文件CommentHelper.Vb代碼內(nèi)容

 
 
 
 
  1. Imports System  
  2. Imports EnvDTE  
  3. Imports EnvDTE80  
  4. Imports EnvDTE90  
  5. Imports System.Diagnostics  
  6. '注釋幫助模塊  
  7. Public Module CommentHelper  
  8. Sub AddClassComment()  
  9. '定義選擇區(qū)域  
  10. Dim DocSel As EnvDTE.TextSelection  
  11. '初始化選擇區(qū)域是當(dāng)前文檔的選擇  
  12. DocSel = DTE.ActiveDocument.Selection  
  13. '選擇區(qū)域移動(dòng)到文檔的開頭  
  14. DocSel.StartOfDocument()  
  15. DocSel.Text = "/*******************************************************************" 
  16. DocSel.NewLine()  
  17. DocSel.Text = "* Copyright (C) abc Corporation" 
  18. DocSel.NewLine()  
  19. DocSel.Text = "* All rights reserved." 
  20. DocSel.NewLine()  
  21. DocSel.Text = "*" 
  22. DocSel.NewLine()  
  23. DocSel.Text = "Author: HBB0b0 (hbb0b0@163.com)" 
  24. DocSel.NewLine()  
  25. DocSel.Text = "Create Date:" + DateTime.Now.ToString()  
  26. DocSel.NewLine()  
  27. DocSel.Text = "Description:" + DTE.ActiveDocument.Name  
  28. DocSel.NewLine()  
  29. DocSel.Text = "*" 
  30. DocSel.NewLine()  
  31. DocSel.Text = "* Date Author Description" 
  32. DocSel.NewLine()  
  33. DocSel.Text = "*******************************************************************/" 
  34. DocSel.NewLine()  
  35. End Sub 
  36. End Module 

3. 在需要添加注釋的項(xiàng)目中打開Macro 瀏覽器,如果看不到AddClassComment宏,則需要導(dǎo)入宏項(xiàng)目

4. 打開需要注釋文件,雙擊或運(yùn)行AddClassComment,就會(huì)添加如下效果的注釋。

 
 
 
 
  1. /*******************************************************************  
  2. * * Copyright (C) abc Corporation  
  3. * * All rights reserved.  
  4. * *  
  5. * Author: HBB0b0 (hbb0b0@163.com)  
  6. * Create Date:2011-3-21 19:51:03  
  7. * Description:Program.cs  
  8. * *  
  9. * * Date Author Description  
  10. * *******************************************************************/  
  11. using System;  
  12. using System.Collections.Generic;  
  13. using System.Linq;  
  14. using System.Text;  
  15. namespace MacroApplication  
  16. {  
  17. class Program  
  18. {  
  19. static void Main(string[] args)  
  20. {  
  21. }  
  22. }  

如果覺得這種方式不方便,可以把它做成ToolBar,下個(gè)項(xiàng)目使用的只需要運(yùn)行ToolBar中的對(duì)應(yīng)按鈕就可以了。

1. 在Tools中選擇自定義

2. 新添ToolBar 名稱為CommentHelper

3. 在命令頁(yè)簽Macros選擇AddClassComment

4. 按住Macro.MyMacros.CommentHelper.AddClassComment,把它拖到CommentHelper容器上

5. 拖放后的效果如下

6. 在以后的使用時(shí)不用再次打開宏項(xiàng)目,直接單擊CommentHelper中AddClassComment按鈕就可以添加類注釋了。

原文鏈接:http://www.cnblogs.com/hbb0b0/archive/2011/03/22/1990670.html


網(wǎng)站名稱:利用VisualStudio2008宏實(shí)現(xiàn)自動(dòng)注釋
分享路徑:http://www.dlmjj.cn/article/dpjhgod.html