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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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; |