-
Dec 2nd, 2021, 10:53 AM
#1
Thread Starter
Fanatic Member
Default properties for forms.
Is there a way to change the default property settings for the design forms?
I ended up blowing up another project because I cannot keep from trying to reset the default property settings to what I want, instead of the crap they keep it in. Touchy little things, if you ask me. They sure hate it when you mess with them.
-
Dec 2nd, 2021, 12:45 PM
#2
Re: Default properties for forms.
Originally Posted by gwboolean
Is there a way to change the default property settings for the design forms?
I ended up blowing up another project because I cannot keep from trying to reset the default property settings to what I want, instead of the crap they keep it in. Touchy little things, if you ask me. They sure hate it when you mess with them.
Not that I know of...you could just create a project checkoff list for roll outs.
Please remember next time...elections matter!
-
Dec 2nd, 2021, 12:46 PM
#3
Re: Default properties for forms.
What default properties are you referring to? I can't think of any.
Most likely, you can create your own, if you wanted to, by creating your own form that inherited from System.Windows.Forms.Form and had the property settings that you wanted. You'd then use your own form as the default rather than the one that System.Windows.Forms.Form. It would work, it just seems like it's not worth bothering with.
My usual boring signature: Nothing
-
Dec 3rd, 2021, 04:15 AM
#4
Re: Default properties for forms.
Odd how so many of the rest of us don't have this issue with projects blowing up. Maybe you could provide an actual description of what you're actually talking about and then we may be able to actually help. I can't think how changing a property could blow up anything, so I have no idea what you're talking about.
-
Dec 4th, 2021, 12:59 PM
#5
Thread Starter
Fanatic Member
Re: Default properties for forms.
Originally Posted by jmcilhinney
Odd how so many of the rest of us don't have this issue with projects blowing up. Maybe you could provide an actual description of what you're actually talking about and then we may be able to actually help. I can't think how changing a property could blow up anything, so I have no idea what you're talking about.
I was just mentioning the blow up. It has little, if anything, to do with the problem I was discussing. It is not odd at all, and probably caused by the fact that my projects are on a SD drive in the side of my Surface pro that occasionally self ejects. It is one of the many self caused problems of someone hard headed. I do know, from causing numerous blowups, that when one messes with control/form/et. al., properties that it is very easy for xml files to get messed up. But I have also noticed that when my project drive ejects while I am in a program that interesting, and seemingly unbeneficial things occur.
The actual problem I am having with property settings probably is, to some degree, a function of keeping the projects on the SD drive. However, I have not really attempted to study that and am not particularly interested in digging into whether that is the actual cause of the issue and/or what the mitigation is. My mitigation for that is to get my crap off that SD drive and onto the C:\ drive.
I described the information I was interested in obtaining, although I included irrelevant information. Let me state again, clearly, that what I am interested in is the never ending redundancy of having to set the same properties every single time I set up a form. What I wanted to know is whether one can change the default property settings for controls/forms, et. al., to those settings that one prefers to consistently use. Based on the other responses, this is not something that can be easily managed.
Odd how you have a tendency to jump to conclusions, that are incorrect, that many of the rest of us do not.
-
Dec 4th, 2021, 01:38 PM
#6
Re: Default properties for forms.
I ended up blowing up another project because I cannot keep from trying to reset the default property settings to what I want
That sure sounds like you think changing the form properties is "blowing up" your project. Not sure how you think jmc jumped to an incorrect conclusion.
If there are a group of form properties that you want to set you could set them up in the project Settings and then call a procedure in the form New event that sets the properties.
Last edited by wes4dbt; Dec 4th, 2021 at 02:14 PM.
-
Dec 4th, 2021, 06:27 PM
#7
Re: Default properties for forms.
Sub classing the form would do it, also. If you ALWAYS (or at least very often) set property X to value Y, then just create a new form derived from the base form and set the property in the derived form.
I'm always fiddling with properties of new forms, but it's never the SAME properties that I fiddle with, or not in the same way. And now that I think about it, it's more common for me to fiddle with the properties of controls on the form than the form itself....except for the border style. I do always seem to be changing that one, and changing it in the same way.
My usual boring signature: Nothing
-
Dec 4th, 2021, 08:25 PM
#8
Re: Default properties for forms.
The properties of the Form class are what they are. The WinForms designer also has some functionality baked into it that will set certain properties of forms and some controls when they are added. If you don't want to accept the property values dictated by the Form class or the WinForms designer for the Form class, neither of which you can change, then you have to not use the Form class as your base. Instead of using the Form (Windows Forms) item template, you can use the Inherited Form (Windows Forms) item template. That allows you to select a form of your own to use as the base class instead of the standard Form class. That form of your own can include whatever modifications you want, including the property values you desire. The form class you choose can be in the current project or another referenced project or library.
I have used this functionality in the past but not for a long time, so I'm not sure exactly what limitations it may have, if any. I just checked and the item template is still available in VS 2019 for .NET Framework projects, but not for .NET 5. In that case, you can add a Form as usual and then go into the designer code file and change the base class there.
-
Dec 4th, 2021, 08:34 PM
#9
Re: Default properties for forms.
Originally Posted by gwboolean
Odd how you have a tendency to jump to conclusions, that are incorrect, that many of the rest of us do not.
I'm interested to know more about tis tendency of mine. Can you provide links to previous examples where I've done so, because a tendency would require a pattern, not a single instance. In this particular instance, as well as in any others, we only know what you tell us. If you tell us that changing form properties blew up a project then the conclusion I will draw is that you changed some form properties and your project "blew up". I'm not sure what "blew up" would actually mean but it sounds serious, i.e. things are generally unusable after they have blown up or, at least, require significant repair. If there is no causal link between the changing properties and the project "blowing up" then why would you make a statement that clearly implies that there is and then criticise us for making that inference?
Originally Posted by gwboolean
I ended up blowing up another project because I cannot keep from trying to reset the default property settings to what I want
You do know that the word "because" indicates that A occurred as a direct result of B, right? If you just provide a full and clear explanation of the problem in the first place, avoiding irrelevancies, then there's less chance of any confusion.
-
Dec 5th, 2021, 12:19 PM
#10
Thread Starter
Fanatic Member
Re: Default properties for forms.
Originally Posted by wes4dbt
That sure sounds like you think changing the form properties is "blowing up" your project. Not sure how you think jmc jumped to an incorrect conclusion.
If there are a group of form properties that you want to set you could set them up in the project Settings and then call a procedure in the form New event that sets the properties.
Not really, although I believe that there is some truth to my statement. The fact is that when one goes in and wrestles with properties, settings, etc., one can easily screw up the xml files behind all of that. I do not see how mentioning that fact, would draw one to the conclusion that this was the cause of my frustration about being unable to reset the property/settings default values, assuming it is even possible. No, JMC jumped to an incorrect conclusion, as is his wont.
What default properties are you referring to? I can't think of any.
I am referring to the settings and properties that already exist behind a given form. For example I might just create a new Windows form. When that form is created a well known properties window is displayed. Now in my forms I like to have my Font as Times New Roman (I hate all non San Sarif fonts), I like the form to be fixed single border style, centered in the form and no control box. As anyone can see, when they view the properties window, all of the settings have default values. They are clearly default values, since that is what shows up in every single form I create.
What I am wanting to know is whether these default values can be changed so that every single time I create a form I do not have to go in and change the values that I routinely use. The best that I have been able to do, to mitigate this annoying activity, is to insert all of the settings/properties as I want them in the load event for the form/object and not bother going into the properties page and resetting the properties to something a little more professional looking than the crap that Microsoft prefers to put in there.
I apologize for my lack of clarity.
Both Shaggy, and Wes have offered suggestions that might suffice, but I have not yet had the opportunity to properly review them and try and work through those suggestions to understand how to implement them. Nor are those suggestions the equivalent to having a means to reset the default settings provided. As it stands at the moment, what I have done is create a routine that has all of the settings I prefer, which I run from the load event, and eliminates the need to go in and change the settings. While this does get the job done, I feel that there should be some means to easily (yeah, right) alter the provided default settings.
JMC, isn't that reaching rather deep to justify a statement you made that was clearly incorrect, and that you clearly took out of context? But I do thank you for stating what I already suspected, which is that the defaults are what they are and any attempt to make them different is difficult, if even possible.
Last edited by gwboolean; Dec 5th, 2021 at 12:31 PM.
-
Dec 5th, 2021, 01:06 PM
#11
Re: Default properties for forms.
Originally Posted by gwboolean
Not really, although I believe that there is some truth to my statement. The fact is that when one goes in and wrestles with properties, settings, etc., one can easily screw up the xml files behind all of that. I do not see how mentioning that fact, would draw one to the conclusion that this was the cause of my frustration about being unable to reset the property/settings default values, assuming it is even possible. No, JMC jumped to an incorrect conclusion, as is his wont.
I am referring to the settings and properties that already exist behind a given form. For example I might just create a new Windows form. When that form is created a well known properties window is displayed. Now in my forms I like to have my Font as Times New Roman (I hate all non San Sarif fonts), I like the form to be fixed single border style, centered in the form and no control box. As anyone can see, when they view the properties window, all of the settings have default values. They are clearly default values, since that is what shows up in every single form I create.
What I am wanting to know is whether these default values can be changed so that every single time I create a form I do not have to go in and change the values that I routinely use. The best that I have been able to do, to mitigate this annoying activity, is to insert all of the settings/properties as I want them in the load event for the form/object and not bother going into the properties page and resetting the properties to something a little more professional looking than the crap that Microsoft prefers to put in there.
I apologize for my lack of clarity.
Both Shaggy, and Wes have offered suggestions that might suffice, but I have not yet had the opportunity to properly review them and try and work through those suggestions to understand how to implement them. Nor are those suggestions the equivalent to having a means to reset the default settings provided. As it stands at the moment, what I have done is create a routine that has all of the settings I prefer, which I run from the load event, and eliminates the need to go in and change the settings. While this does get the job done, I feel that there should be some means to easily (yeah, right) alter the provided default settings.
JMC, isn't that reaching rather deep to justify a statement you made that was clearly incorrect, and that you clearly took out of context? But I do thank you for stating what I already suspected, which is that the defaults are what they are and any attempt to make them different is difficult, if even possible.
https://docs.microsoft.com/en-us/vis...s?view=vs-2022 might worth a read, it gives you a way of creating your own template items. That way you could have your own Form template in the New Item... dialog box that has already had your preferences set up.
-
Dec 5th, 2021, 01:29 PM
#12
Re: Default properties for forms.
Not really, although I believe that there is some truth to my statement. The fact is that when one goes in and wrestles with properties, settings, etc., one can easily screw up the xml files behind all of that. I do not see how mentioning that fact, would draw one to the conclusion that this was the cause of my frustration about being unable to reset the property/settings default values, assuming it is even possible. No, JMC jumped to an incorrect conclusion, as is his wont
Well, jmc, me and I bet 99% of the people. But who cares, the point has been made and whether we agree doesn't really matter or help solve your problem, I'm ready to move on.
btw - Just for clarity, a Form doesn't have a xml file associated with it, the forms properties settings are in the design.vb file which is standard text.
Last edited by wes4dbt; Dec 5th, 2021 at 01:36 PM.
-
Dec 7th, 2021, 06:42 AM
#13
Re: Default properties for forms.
Originally Posted by wes4dbt
btw - Just for clarity, a Form doesn't have a xml file associated with it, the forms properties settings are in the design.vb file which is standard text.
WPF and UWP apps use XAML which is just XML to define UI layouts. I might be wrong but I don't think OP explicitly stated it was a WinForms application he was working on. He should probably clarify this.
-
Dec 7th, 2021, 07:44 AM
#14
Re: Default properties for forms.
It sounds to me like the OP is going into the file and making changes to it outside the form designer and introducing problems. In the past the IDE would warn you not to do this, not sure if it still does or not.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|