Author Topic: Making New Forms Default to a Certain Size and Color with Templates  (Read 2793 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
If you ever created a multi form project, then you know the default size for a new form is 300x300. This usually means you have to resize every new form you add. Visual Studio has a nice tool to simplify this. Once you setup a new form the way you want, you can export it as a template then it will show up in your item list when you do a Add New. Try this:

- Open either a new or existing project in Visual Studio
- In Solution Explorer, right click the project and select Add Existing Item
- Select Windows Form from the list and give it the name FormTemplate
- You will now have a new 300x300 gray form
- Change the form size to something like 800x600
- You can also change any other properties like the BackColor
- From the menu select File->Export Template
- It may ask you to save the project
- You will now have an option to select the template type. Select Item Template
- Click Next
- In the list, put a check in the box next to FormTemplate
- Click Next
- It will now ask about references, just click Next
- In the next windows give your template a name
- Make sure the box "Automatically Import the Template.." is checked
- Click Finish

Now when you add a New Item yo your project, you should see your form template in the list. If not, try exiting VS and re-open, then try again.