WinControl reserved Space lazarus / 31-LCL ---------------------------------------------------------------------- Warfley · 2020-07-18 11:01 Hey, I've just gotten curious about something. Components like groupboxes have reserved space, in the case of the groupbox there is a header contining the caption. Positioning a Button on Location (0, 0) positions it right under the header, increasing the font size increases the header size. So my question is now, when creating my own component, how can I reserve space like that, i.e. have an offset in child positioning (and also, but this is secondary, have the controls slide "under" the header, i.e. they disappear when getting negative coordinates) ---------------------------------------------------------------------- jamie · 2020-07-18 12:44 U r most likely talking about the non client area. ? U can create the window with non client borders by changing the values in the createparams You override that to modify the window style before its created. ---------------------------------------------------------------------- Warfley · 2020-07-18 14:16 Any example for this? ---------------------------------------------------------------------- jamie · 2020-07-18 15:54 Here is a quick hack for a control with the thick border and a title bar that you can be moved around in the parent form.  Not exactly sure what you are looking for but maybe the same as a Tgroupbox ? If that is being the case then you can use two controls , one as the master which can draw the border line and place your caption anywhere you wish, then the child of that control can be your client content. This way you can get two different set of events, one for the border and one for the smaller area..  Anyways, clipped here is an example of overriding the CreateParams, this gives you something interesting, at least on windows it does. I assume it should work on other targets too, I didn't use anything special other than the LCLType and LCLIntf. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs,LCLType, LCLintF,Windows; type TMyControl = Class(TCustomControl)   Procedure Createparams(var params:TCreateparams); Override; end;   { TForm1 }   TForm1 = class(TForm)    procedure FormCreate(Sender: TObject);  private   public    AControl:TMyControl;   end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin AControl := TMyControl.Create(Self); Acontrol.Parent := Self; AControl.Width := 100; ACOntrol.Height:= 100; Acontrol.Caption :='Something'; Acontrol.Visible:=true;end; Procedure TMyControl.Createparams(var params:TCreateparams);Begin  Inherited;  params.Style := params.Style or WS_CAPTION;  Params.ExStyle := Params.Exstyle or WS_EX_OVERLAPPEDWINDOW;end; end. ---------------------------------------------------------------------- MarkMLl · 2020-07-18 16:09 Watch out for the case where groupboxes take a different amount of space depending on whether the caption is blank or not. ISTM that Autosizing a form is the complement of fitting a control into the available client space. MarkMLl ---------------------------------------------------------------------- jamie · 2020-07-18 17:05 a single window can be used for this if he wants to handle all of it in the WM_BEGINPAINT call..  First the outside border may need updating and then a region can be placed within the DC context to that everything relative to some port of the control. That basically would behave like a client area.