tutorial on changing default values for WinForm form properties in asp.net

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.