I want to prevent a descendant of TPageControl
from having a Style
property except tsTabs
.
At first glance I tried to override SetStyle
, but it is declared private in the base class. anyone have ideas?
TPageControl
does not natively support what you are asking for. To accomplish what you are asking for, you would have to either:
have your component re-declare the Style
property with new getter/setter methods, and then have the setter exit without doing anything. However, the inherited Style
property will still technically be accessible at runtime if the user of the component really wants to access it.
derive your component from TCustomTabControl
instead of TPageControl
, and re-implement everything that TPageControl
does, but without promoting the protected Style
property. However, the inherited Style
property will still technically be accessible at runtime if the user of the component really wants to access it.
have your component override the virtual CreateParams()
method and force the TCS_TABS
window style in the TCreateParams.Style
field. The Style
property will still have whatever value the user assigns (which will also affect the behavior of the TabPosition
property), but at least the underlying window will always behave as if the tsTabs
style were being used.
use a detouring library to hook TCustomTabControl.SetStyle()
directly at runtime and make it return without doing anything.