You cancreate a Property to override the Size propertyof the Panel andmake it un-browserable, then the Size propery will not be displayed on the PropertyGrid,something like this:
Code Block
Designer(typeof(MyPanelControlDesigner))]
public class MyPanel : Panel
{
public MyPanel()
{
this.BackColor = Color.Red;
}
[Browsable(false)]
public new Size Size
{
get { return base.Size; }
set { base.Size = value; }
}
}
public class MyPanelControlDesigner : System.Windows.Forms.Design.ControlDesigner
{
public override System.Windows.Forms.Design.SelectionRules SelectionRules
{
get
{
return System.Windows.Forms.Design.SelectionRules.None;
}
}
}
You cancreate a Property to override the Size propertyof the Panel andmake it un-browserable, then the Size propery will not be displayed on the PropertyGrid,something like this:
Code Block
Designer(typeof(MyPanelControlDesigner))]
public class MyPanel : Panel
{
public MyPanel()
{
this.BackColor = Color.Red;
}
[Browsable(false)]
public new Size Size
{
get { return base.Size; }
set { base.Size = value; }
}
}
public class MyPanelControlDesigner : System.Windows.Forms.Design.ControlDesigner
{
public override System.Windows.Forms.Design.SelectionRules SelectionRules
{
get
{
return System.Windows.Forms.Design.SelectionRules.None;
}
}
}
I made most of the properties that should not be changed not browsable.
So they are at least not visible in the designer anymore.
It's not really what i had in mind but it's good enough.
Thanks for the help |