[SOLVED] Visual artifacts when showing a form inside a panel (Laz 1.2.6 Win32) lazarus / 31-LCL ---------------------------------------------------------------------- lazjump · 2014-10-28 07:48 Hello, I am currently making a Windows-only application where the user interface is somewhat resembles the ribbon UI like in MS Office. But my application is rather SDI, not MDI, because only one "child form" could be visible at a time. The main form have a Page Control on the top side, and a Panel below. I put SpeedButtons on the TabSheets of the PageControl as menu buttons. When a button clicked, then a corresponding child form is created and displayed inside the Panel (Panel is the parent of the child form). Here is the method to create and show forms inside the panel: Code: [Select]procedure TfMain.CreateAndShowForm(Form: TForm; FormClass: TFormClass); begin   CloseActiveForm;   Form:=FormClass.Create(Application);   ActiveForm:=Form;   Form.Parent:=pnlContent;   Form.BorderStyle:=bsNone;   Form.WindowState:=wsMaximized;   Form.Show;   Self.Caption:=Form.Caption; end;  The block of code above worked fine with Delphi 7. But in Lazarus, it would cause visual artifacts like black borders around buttons and another areas of the form beyond the original size of the child form. I had tinkered for some hours to find a workaround but I have not succeed yet. So I would be glad if someone could help me to find a workaround. Here is the link to a sample project you can play with: https://www.dropbox.com/s/vxur1pqou06yhsy/UI%20Test.7z?dl=0 I am using Lazarus 1.2.6 (with the FPC that comes with it) on Windows XP SP2. Thanks EDIT: add code tags. ---------------------------------------------------------------------- taazz · 2014-10-28 08:51 try this one. Code: [Select]procedure TfMain.CreateAndShowForm(Form: TForm; FormClass: TFormClass); begin   CloseActiveForm;   Form:=FormClass.Create(Application); //  ActiveForm:=Form;   Form.BorderStyle:=bsNone;   Form.Align := alClient; //WindowState:=wsMaximized;   Form.Parent:=pnlContent;   Form.visible := True;   Self.Caption:=Form.Caption; end; ---------------------------------------------------------------------- lazjump · 2014-10-28 09:08 Wow! Thank you taazz! It works  And we don't need to use the OnResize event of the main form anymore! (I don't comment out ActiveForm:=Form; because the reference is still needed). Thanks again taazz