Building my baseclasses for user interface controls is getting there. I have command buttons derived with custom font assignment and put on a form, all is fine… However, identical code for the read-only property Font of a textbox is NOT recognized properly on the same form. It is ONLY taking the setting of the FORM and disregarding its own Font declaration.
public class MyTextbox : TextBox { [ReadOnly(true)] public override Font Font { get { return new Font( 'Courier New', 12f, FontStyle.Regular, GraphicsUnit.Point ); } } }
With a help from ‘nobugz’ (Thanks), I found this same failure when doing a ComboBox too. My result was the following…
My getter
However, in nobugz response, something wasn’t working quite right with the compiler, so in the constructor of the class