Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defaulting Properties
Message
From
18/01/2007 10:27:00
 
 
To
18/01/2007 10:22:08
General information
Forum:
ASP.NET
Category:
Class design
Miscellaneous
Thread ID:
01186613
Message ID:
01186647
Views:
26
Thanks Perry, but I don't think that's what I need. I simply don't want all that extra crap generated every time I drop my TextBox from the ToolBox to the design surface.

~~Bonnie



>I don't remember the details, so I'm not sure if this will help in this situation. But in a Kevin McNeish session I attended last year, he showed us how to create our own user templates in the IDE.
>
>So that in addition to picking Winform, Class Library, User Control, etc, you will have your own list available in the bottom half of the screen.
>
>I hope this is enough to get you started, at least.
>
>>Hi gang,
>>
>>I know that in my sub-classes for controls such as TextBoxes, I can avoid having the IDE stick extra code in the "IDE-generated" code for properties by setting a DefaultValue in the TextBox sub-class. Like this:
>>
>>public class MyTextBox : TextBox
>>{
>>    private string m_MyProperty;
>>
>>    public MyTextBox
>>    {
>>        this.m_MyProperty = "";
>>    }
>>
>>    [DefaultValue("")]
>>    public string MyProperty
>>    {
>>        get {return this.m_MyProperty;}
>>        set {this.m_MyProperty = value;}
>>    }
>>    [DefaultValue(typeof(Color), "Window")]
>>    public override Color BackColor
>>    {
>>        get {return base.BackColor;}
>>        set {base.BackColor = value;}
>>    }
>>    [DefaultValue(typeof(Color), "WindowText")]
>>    public override Color ForeColor
>>    {
>>        get {return base.ForeColor;}
>>        set {base.ForeColor= value;}
>>    }
>>}
>>
>>Note that the BackColor and ForeColor properties are overridden. This all works just fine, but where I'm having a problem is with some of the properties in ComboBoxes that are not virtual properties and therefore cannot be overridden ... such as the DropDownStyle, DropDownWidth and several others. Does anybody know how to set up a DefaultValue for these?
>>
>>TIA,
>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform