Delphi – How to make a component disappear in the form designer


I'm creating a custom control that contains other controls, including two scroll bars, one horizontal, one vertical. There's a property to set one or both scroll bars invisible, which works fine at runtime, but at design-time it doesn't disappear from the form designer when I set the property.

Now, I can understand how this could be a useful feature if this was an individual control, but it's part of an aggregate component and so it ought to obey the parent control's rules, not the form designer's. Is there any way to make sure the control will disappear when I set .Visible := false; even when it's in the form designer?

Best Solution

You can set the "csNoDesignVisible" ControlStyle flag of the control. If that flag is set the Visible property will work as it does at runtime.

Related Question