Programmatically adding controls to TPanel hides its bevel lazarus / 31-LCL ---------------------------------------------------------------------- Superdisk · 2021-06-06 18:51 I have a TPanel, and I'm trying to add a custom control to it by setting the control's Parent property to the TPanel. Unfortunately, it looks like the attached image. As you can see, the bevel is hidden underneath the control itself-- it's like the control is taking up more than the client area of the panel. If I add a control using the IDE (not programmatically) and set the Align to alClient, you can see that it takes up the correct amount of space. How do I fix this? ---------------------------------------------------------------------- jamie · 2021-06-06 19:25 The bevel is part of the client area of the panel.. its not a separate border component.. You need to offset your child controls to the width of the bevel.  you could waste some resources by putting a panel inside another panel then shrink the inner panel using the anchor editor and then apply the child controls to the inner panel  also there is Child sizing in the panel that suppose to help you in this cause. ---------------------------------------------------------------------- howardpc · 2021-06-06 20:01 I don't think jamie is correct. This code 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 type   TMyControl = class(TCustomControl)  end;   TForm1 = class(TForm)    Panel: TPanel;    procedure FormCreate(Sender: TObject);  private    FMyControl: TMyControl;  end; var  Form1: TForm1; implementation procedure TForm1.FormCreate(Sender: TObject);begin  Color := clSilver;  panel.BevelWidth := 10;  FMyControl := TMyControl.Create(Self);  FMyControl.Align := alClient;  FMyControl.Color := clSkyBlue;  FMyControl.Parent := Panel;end; gives the attached screenshot. ---------------------------------------------------------------------- jamie · 2021-06-06 21:24 Drop a control on it from the OI.. Like a TBUTTON or TEDIT.. You can place that anywhere in that panel, including over the bevel. and yes, using the Client align fixes that but how about when you don't want that ? Without alignment the LCL allows it to hang over the bevel so its not 100% fool proof but one can simply anchor so it does not matter. Also note that when doing so the LEFT,TOP of the control is no longer 0,0 but where the bevel ends off.