Delphi custom TPanel component

delphidelphi-xe

I have a custom component based on a TPanel. The aim is to display at the top, a so called "title area", wich displays a caption and has customizable border and background color. It works fine, except for a little issue: at design time, when clicking on the "title area",
the component is not selected (blue bullets doesn't appear), meaning that I can't drag or modify the component's properties. If I click outside the "title area", the component is selected. Can anyone have enter image description herea solution for this? Thanks in advance. Follows a brief descriptive image:

Best Solution

For the title panel set (e.g.):

constructor TMyTitlePanel.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  ControlStyle := ControlStyle - [csAcceptsControls] + [csNoDesignVisible];
end;

Another option is to use SetSubComponent(True) for the title panel: https://stackoverflow.com/a/9479909/937125

Related Question