I looked around a bit and can not answer the question of how to effectively "override" Control.Enabled in C # WinForms 3.5.
Our situation is that we are using a basic form or a basic form that adds a status bar at the bottom and a toolbar at the top. This form is inherited by all our other forms, and then adds controls to the central panel.
In some forms that inherit from the main base form, we want to be able to use the "Enabled" property in the form, but we want to redefine the functionality so that it only disables the center panel, and not in the status bar / menu, and thus it can move the form.
I tried to do the following in the main form (FrmBaseStatus):
private bool enabled = true; public new bool Enabled { return this.enabled; } set { this.enabled = value; this.panelBase.Enabled = value; }
However, this is obviously not a true redefinition, and if we have a user control in the base panel in one of our inherited forms, and we want to redefine the form from this user control, we should do something like:
((FrmBaseStatus)this.ParentForm).Enabled = true;
Is there any other way to do this, or are we fixated on always discarding our base form in order to achieve the Enabled property we want to use.
Note. Does this event replace OnEnabled and do not call the base function OnEnabled, or does this enable and disable fail in this case Control.OnEnabled ()?
source share