How to prevent Visual Studio setting my default font sizes in an inherited control
Posted
by Colin
on Stack Overflow
See other posts from Stack Overflow
or by Colin
Published on 2010-03-23T10:52:06Z
Indexed on
2010/03/23
10:53 UTC
Read the original article
Hit count: 296
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 Appearance().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.
© Stack Overflow or respective owner