Fork me on GitHub

Vs自定义设置

1.固定选项卡独立行显示设置

 

 效果如下

 

2.语言设置

 

可以从官网寻找所需版本语言包

https://my.visualstudio.com/downloads

 

 

3.代码段设置

可以对现有的进行一些改造,更适合你自己的习惯,或者添加自己的代码段。

 

4.代码模板

修改一些现有的模板,可以规范我们的代码,减少一点点的重复性工作。

以C#中WinForm举例

新增一个Windows窗体后,生成以下的代码模板

 

实现方法:

文件路径:C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp\Windows Forms\2052\Form

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 $if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
 7 $endif$using System.Text;
 8 $if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
 9 $endif$using System.Windows.Forms;
10 
11 namespace $rootnamespace$
12 {
13     /// <summary>
14     /// 
15     /// </summary>
16     public partial class $safeitemrootname$: Form
17     {
18         #region 变量
19         
20         #endregion
21         
22         #region 构造
23         public $safeitemrootname$()
24         {
25             InitializeComponent();
26             Load += $safeitemrootname$_Load;
27         }
28         #endregion
29         
30         #region 事件
31         
32         #region 窗体加载事件
33         /// <summary>
34         /// 窗体加载事件
35         /// </summary>
36         /// <param name="sender"></param>
37         /// <param name="e"></param>
38         void $safeitemrootname$_Load(object sender, EventArgs e)
39         {
40 
41         }
42         #endregion
43         
44         #endregion
45         
46         #region 方法
47         
48         #endregion    
49     }
50 }

知识点:

1)ItemTemplates与ItemTemplatesCache的区别在于,如果您设置了ItemTemplates下的模板,需要在VS命令行中运行devenv /setup 命令  ,以Itemtemplates模板生成ItemTemplatesCache的模板,也就是说ItemTemplatesCache模板的设置会被原始的Itemtemplates模板还原。

2)1033和2052是LCID(Locale ID,区域性标识符),1033 表示英语(美国),2052表示简体中文。

 

posted @ 2018-01-05 16:50  LikeHeart  阅读(739)  评论(1编辑  收藏  举报