resize Form when enable or disable control... lazarus / 21-General ---------------------------------------------------------------------- eldonfsr · 2022-05-26 23:43 Hi how i can resize form if enable or disable and visible or not visible at form image is all controls enabled and visible and 2 image you can see i disable and not visible the panel, and 3 image you can see is showing form with free space where must be going panel... What i need is change form and adjust to the controls like change height of form.... ---------------------------------------------------------------------- zoltanleo · 2022-05-27 04:21 Hi eldonfsr 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 procedure TForm1.CheckBox1Change(Sender: TObject);begin  Panel2.Visible:= CheckBox1.Checked;  Self.Repaint;end; procedure TForm1.FormCreate(Sender: TObject);begin  Panel1.Color:= clMoneyGreen;  Panel1.Constraints.MinWidth:= 300;  Panel1.Caption:= '';  Panel2.Color:= clCream;  Self.AutoSize:= True;  CheckBox1.Checked:= True;  CheckBox1Change(Self);end; https://i.imgur.com/0ltI6PM.gif Upd: But I am of the opinion that the size of the form should not change. It's better to resize adjacent controls. 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 procedure TForm1.FormCreate(Sender: TObject);begin...  //Self.AutoSize:= True;...end; https://i.imgur.com/WRztmkV.mp4 ---------------------------------------------------------------------- eldonfsr · 2022-05-27 14:40 Thanks for your replay, well after some test is working  but as must be.... why first thing is i don't know you can see image 1 las panel is no show as is only half if that is showing...happen if its align to bottom too..... but you check on second when panel i align to client is show complete but bigger that it is size is 35 height you can see previous post at image 1 is mast be look... procedure TFormMain.FormCreate(Sender: TObject); begin   If Not DirectoryExists(GetUserDir +'AppData\Local\Sbackup') then begin        If Not CreateDir (GetUserDir +'AppData\Local\Sbackup') Then           Showmessage('Can create a folder for save backup files configuration');;     end;     FormMain.Top:=10;     FormMain.Left:=10;     FormMain.Panel5.Height:=35;     FormMain.StatusBar1.Panels[0].Width:= FormMain.StatusBar1.Width div 2;     Self.AutoSize:= True; end; ---------------------------------------------------------------------- eldonfsr · 2022-05-27 18:14 I made a test apps you can see if you change align of panel five top, bottom and client how is show in different view... ---------------------------------------------------------------------- eldonfsr · 2022-05-27 18:35 Big question why if form has statusbar affect view of form, If delete status bar all controls is show as must be but if form has status bar cut at bottom if form some part and affect control near to status bar.... I never put attention on that ..... some idea of that how to fix..... ---------------------------------------------------------------------- Thaddy · 2022-05-28 08:15 The form needs to be able to receive messages, which is not possible if it is disabled. The resize messages are no exception! ---------------------------------------------------------------------- zoltanleo · 2022-05-30 18:40 Quote from: eldonfsr on May 27, 2022, 08:35:47 pmBig question why if form has statusbar affect view of form, If delete status bar all controls is show as must be but if form has status bar cut at bottom if form some part and affect control near to status bar.... I never put attention on that ..... some idea of that how to fix..... In your case, I didn't find any problem with resizing the form. You just need to make the correct anchoring of the controls on the form (you need to anchor statusbar to bottom edge of the form, panel5 to the statusbar, and panel8 to panel5). I even removed the Self.Repant method because it works anyway. 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 procedure TForm1.CBShowPChange(Sender: TObject);begin  Panel8.visible:= CbShowP.Checked;end; procedure TForm1.FormCreate(Sender: TObject);begin  with Panel8 do  begin    Constraints.MinHeight:= ProgressBar1.Height                        + BorderSpacing.Bottom                      + BorderSpacing.Top;    Constraints.MaxHeight:= Constraints.MinHeight;  end;    with Panel5 do  begin    Constraints.MinHeight:= BtnStart.Height                            + BtnStart.BorderSpacing.Top                            + BtnStart.BorderSpacing.Bottom;    Constraints.MaxHeight:= Constraints.MinHeight;  end;  Self.AutoSize:= True;  CBShowPChange(Sender);end; ---------------------------------------------------------------------- eldonfsr · 2022-06-03 13:38 Yes but if you change status bar align bottom you will see affect panel5 it is now showing complete... thanks... is great help i learned  other way to implements those things. thanks...