How to assign Form1.WindowsState:=wsMaximized lazarus / 31-LCL ---------------------------------------------------------------------- asdf · 2011-02-22 15:06 procedure TForm1.FormCreate(Sender: TObject);  Form1.WindowState:=wsMaximized; // Form1 stretched out in full screen so well. Panel1.Top:=8; // this line worked well. Panel1.Left:=8; // this line worked well. Panel1.Width:=Form1.ClientWidth-16; // Panel1.Width didn't work. But why did it work in procedure TForm1.FormShow(Sender: TObject);  ? And what are the differences between procedure TForm1.FormCreate(Sender: TObject);  and procedure TForm1.FormShow(Sender: TObject); ? ---------------------------------------------------------------------- eny · 2011-02-22 15:11 Quote from: asdf on February 22, 2011, 04:06:27 pmPanel1.Width:=Form1.ClientWidth-16; Don't have all the answers, but an easy fix for the above is using the Anchors property. ---------------------------------------------------------------------- Lush · 2011-02-22 15:53 Hi, I may be wrong but I believe ClientWidth is either undefined or doesn't hold the right value because there's no "outside context" when the onCreate event is triggered. When the onShow event is fired, your form is placed inside its client (the screen I guess), and then the ClientWidth becomes available to your form. Lush ---------------------------------------------------------------------- Leledumbo · 2011-02-22 18:02 QuoteAnd what are the differences between procedure TForm1.FormCreate(Sender: TObject);  and procedure TForm1.FormShow(Sender: TObject); ?FormCreate is called AFAIR right after the form is created, in this method, the form handle exists, but the form not yet shown. FormShow is called AFAIR right before the form is shown. I'm not really sure why it works in FormShow but not in FormCreate, my guess is the ClientWidth is different between those two methods. The calculation might be done in between.