I have a base class for all my textboxes and I want to set the default font in that class. So I started with this:
public partial class MyTextBox : TextBox
{
public WmlTextBox()
{
InitializeComponent();
//Font for the whole application can be altered in the Appearance class
Font = new Appea开发者_开发技巧rance().TextBoxFont;
}
}
I then stripped out all the code in the form that was setting the font of the textboxes. Of course this worked fine until I altered an item on the page. Visual Studio picked up the default font for the application (set in the Appearance class), and generated code in the designer for all TextBoxes to set it to that specific font. How can I stop visual studio from generating code from my default font? I want to allow the developers to change the property, but I want to set the default font centrally.
override/new the Font
property, and apply the DesignerSerializationVisibility
attribute with the Hidden
option.
精彩评论