简体   繁体   中英

VB2010 or VB.NET changing default form properties

Is there any way to change the default form properties when starting a new forms project, or adding a new form to an existing project. For example... the current default for any new form created for "Start Position" is "Windows Default Location"... but I want every form to be "Center Screen".... also, the default "AutoScaleMode" setting is "Font".... I want this to be "None"... yes, I can change these settings in the properties when I create the new form, but I want to change the default. It is annoying having to change these (and a few other) setting every time I create a new form.

You could edit the default Item or Project templates stored in C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\ .

I would suggest that you create your base Form/Project and export them; File Menu->Export Template. You often need to do a bit of touch up of the wizard generated files with a text editor though.

To learn more, see: Visual Studio Templates


Edit: The template wizard will drop the custom project template in the C:\\Users\\USERNAME\\Documents\\Visual Studio 2010\\Templates\\ProjectTemplates folder when you have left the "Automatically import the template into Visual Studio" option checked. There should be a sub-folder named "Visual Basic" in that folder. Any folder you add under "Visual Basic" will show up under the "Installed Templates" view. You can move your template file (the zip file) to a specific folder in that folder hierarchy to categorize your templates. I hope that that description made sense.

Also, if you choose to modify the system template structure located under C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\ , you will need to update the cache by executing the following command in a Command Prompt window.

devenv /installvstemplates

Easy solution: Create a form you want as your default with all the parameters setup. Then just copy the designer view and the code view into their respective places for the new form. You can do this between projects

If it is within the same project you can just copy past the form in the solution explorer to generate more based off the template you created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM