Hafedh TRIMECHE 1 Posted November 7, 2021 AutoSize has not effect on a TPanel component. When set to True, the width is kept unchanged. Share this post Link to post
Uwe Raabe 2057 Posted November 7, 2021 Works perfectly with a simple test program. Probably some settings on your side. Can you attach a small example so that we can see a bit more? Share this post Link to post
Stano 143 Posted November 7, 2021 It also depends on where you placed the panel. And what neighbors I have. With what settings. Share this post Link to post
Hafedh TRIMECHE 1 Posted November 7, 2021 object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 441 ClientWidth = 624 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -12 Font.Name = 'Segoe UI' Font.Style = [] PixelsPerInch = 96 TextHeight = 15 object Panel1: TPanel Left = 96 Top = 32 Width = 185 Height = 41 AutoSize = True Caption = 'Panel1' TabOrder = 0 end end Share this post Link to post
Uwe Raabe 2057 Posted November 7, 2021 And to what controls are you expecting the panel to adjust its size? Or more general, what do you think what AutoSize does? Share this post Link to post
Hafedh TRIMECHE 1 Posted November 7, 2021 When a Panel is empty (no controls) it would adjust its size to the text width as it is done when using a TLabel. Share this post Link to post
Uwe Raabe 2057 Posted November 7, 2021 Setting AutoSize of a panel to true makes the panel adjust its size so that all contained controls are still visible, but nothing more. It takes AdjustWithMargins of the controls into account. The panel Align value takes precedence over the AutoSize. Share this post Link to post
Stano 143 Posted November 7, 2021 30 minutes ago, Hafedh TRIMECHE said: When a Panel is empty (no controls) it would adjust its size to the text width as it is done when using a TLabel. This is what TAdvPanel does Share this post Link to post
FreeDelphiPascal 19 Posted March 22, 2022 If you put Panel1 inside the Panel2 (both autosize:= true) and you create some dynamic buttons in Panel1, the autosize feature will fail. Share this post Link to post