While TPageControl (located on the Win32 tab of the component palette) enables you to build a multiple page dialog or tabbed notebook type of interface, by adding components to each page of the control - you might sometimes want to host an entire form in a page.
Here's how to dynamically place a Delphi Form into a TabSheet of a TPageControl - while still being able to use a Form as a stand-alone window.
Note: We are placing an instance of a "TMyForm" form in a new TabSheet for an existing TPageControl component named "PageControl1".
~~~~~~~~~~~~~~~~~~~~~~~~~
var
aForm : TMyForm;
tabSheet : TTabSheet;
begin
//Create a new tab sheet
tabSheet := TTabSheet.Create(PageControl1) ;
tabSheet.PageControl := PageControl1;
//create a form
aForm := TMyForm.Create(tabSheet) ;
aForm.Parent := tabSheet;
aForm.Align := alClient;
aForm.BorderStyle := bsNone;
aForm.Visible := true;
tabSheet.Caption := aForm.Caption;
//activate the sheet
PageControl1.ActiveSheet := tabSheet;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» How to Enable the Refresh button on a DBNavigator for ReadOnly Datasets
« Logging Exceptions in Delphi Applications

