Reputation: 319
How can I force a control right to left and font property (and other properties if they are affected) in C# or Vb.net not to be affected by their containers?
For example when I put a Textbox into a panel which it's font is "Font A", Textbox font property font becomes "Font A". How can I avoid this?
Upvotes: 2
Views: 274
Reputation: 22008
To override property (so its value is not default for that control type and not taken from parent somehow) you can do following
[System.ComponentModel.DesignerCategory("Code")]
public class MyLabel : Label
{
[DefaultValue(true)]
public new bool AutoSize
{
get { return base.AutoSize; }
set { base.AutoSize = value; }
}
public MyLabel()
{
AutoSize = true;
}
}
Upvotes: 2