Every time you create a new WinForm application project, the first thing is to modify the Form1 form FormBorderStyle, MaximizeBox, and startposition three property values, is there any way to automatically modify these property values when creating the project? Form class can not be modified, custom control too troublesome, and the second, as long as the project can be created in the Form1.Designer.cs file automatically add the following three lines of code:
| The code is as follows |
Copy Code |
This. FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; This. MaximizeBox = false; This. StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; |
This can be done by modifying the project template, taking visual Studio 2012 as an example, where the template file location is:
C:/Program Files/microsoft Visual Studio 11.0/common7/ide/projecttemplates/csharp/windows/2052/windowsapplication/ Form1.Designer.cs
After you have opened your modifications, you can:
Description: The new Windows Forms template file location is: C:/Program files/microsoft Visual Studio 11.0/common7/ide/itemtemplates/csharp/windows forms/ 2052/form/form.designer.cs