nnbbb09
asked on
Controlling the available client area of a control
I'm writing a new control that inherits from TCustomPanel and it will draw a Caption area similar to a Form at the top of the panel. However when components are dropped on the panel they can overwrite this Caption area.
Is there someway of controlling the available client area of a control
Thanks
Jo
Is there someway of controlling the available client area of a control
Thanks
Jo
ASKER
Tried it for a descendent of TPanel but the painting of the control was very unpredictable.
Jo
Jo
An easier way would be to add another TPanel, align it to Top. :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cynna,
I went for the second option. It's a great solution and exactly what I'm looking for.
Thanks
Jo
I went for the second option. It's a great solution and exactly what I'm looking for.
Thanks
Jo
// .....
protected
function GetClientRect: TRect; override;
// .....
function TmyPanel.GetClientRect: TRect;
begin
with Result do begin
Left := Self.Left;
Top := CaptionAreaHeight; // <- this will reduce components client area
Right := Self.Width;
Bottom := Self.Height;
end;
end