自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

利用Visual Studio 2008宏實現自動注釋

開發(fā) 后端
我們今天要介紹的是利用Visual Studio 2008宏實現自動注釋功能,希望這個小工具能給大家有所幫助。

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

2. MyMacros 刪除默認文件 Module1.vb,添加文件CommentHelper.Vb代碼內容

  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ū)域是當前文檔的選擇  
  12. DocSel = DTE.ActiveDocument.Selection  
  13. '選擇區(qū)域移動到文檔的開頭  
  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. 在需要添加注釋的項目中打開Macro 瀏覽器,如果看不到AddClassComment宏,則需要導入宏項目

4. 打開需要注釋文件,雙擊或運行AddClassComment,就會添加如下效果的注釋。

  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,下個項目使用的只需要運行ToolBar中的對應按鈕就可以了。

1. Tools中選擇自定義

2. 新添ToolBar 名稱為CommentHelper

3. 在命令頁簽Macros選擇AddClassComment

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

5. 拖放后的效果如下

6. 在以后的使用時不用再次打開宏項目,直接單擊CommentHelperAddClassComment按鈕就可以添加類注釋了。

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

【編輯推薦】

 

  1. Visual Studio 2008在Web.config文件中注冊web用戶控件
  2. Visual Studio 2008中創(chuàng)建web用戶控件
  3. Visual Studio 2008的ListView數據排序
  4. Visual Studio 2008的標記導航功能
  5. Visual Studio 2008中綁定ListView控件
責任編輯:彭凡 來源: 博客園
相關推薦

2010-09-27 09:13:36

Visual Stud

2010-05-25 13:50:35

Visual Stud

2009-11-12 09:15:33

Visual Stud

2009-12-17 15:38:21

Visual Stud

2009-12-18 13:39:40

Visual Stud

2009-12-16 15:44:20

Visual Stud

2009-12-14 15:46:38

visual stud

2009-12-17 15:22:27

Visual Stud

2009-12-16 14:51:27

Visual Stud

2009-07-01 17:15:25

ListView數據排Visual Stud

2009-07-01 17:04:13

ListViewVisual Stud

2009-07-01 17:11:32

標記導航Visual Stud

2013-05-29 14:54:49

Visual Stud

2010-09-10 09:35:59

Visual Stud

2009-07-01 16:52:47

增加瀏覽器Visual Stud

2009-12-16 15:39:37

Visual Stud

2009-07-01 17:20:10

web用戶控件Visual Stud

2009-12-03 13:47:13

Microsoft V

2009-09-24 10:10:07

Visual Stud

2009-12-11 17:20:36

Visual Stud
點贊
收藏

51CTO技術棧公眾號