How To…Show the Designer in Panel

Question

“How can I show/embed the Designer in a Panel?”

Solution

The following example uses the Designer.ShowInPanel method to display the display the designer within a panel and optionally move the menu bar to the parent form.

Download: ShowDesignerInPanel.zip

Sample Delphi code:

procedure TForm1.btnShowDesignerPanelClick(Sender: TObject);
begin

  ppDesigner1.ShowInPanel(Panel1);

end;

procedure TForm1.btnShowDesignerInPanelClick(Sender: TObject);
begin

  // move the menu dock to this form
  ppDesigner1.Form.MainMenu.CurrentDock.Parent := Self;

end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  // restore menu dock to designer form
  // note: without this code, there will be a destroy AV
  ppDesigner1.Form.MainMenu.CurrentDock.Parent := ppDesigner1.Form;

end;