1

I want to improve the look of my app by TPagecontrols with rounded cornes like the one used by the DELPHI IDE itself. How can I do this ????

sample from DELPHI XE GUI

Franz
  • 1,883
  • 26
  • 47

1 Answers1

3

The Delphi IDE uses a TTabSet component. A big difference between TPageControl and TTabSet is TTabSet does not automatically change between different views of controls the way a TPageControl does. You need to update the display manually when the tab is clicked.

You could override the painting of the TPageControl tabs to make them look like the TTabSet tabs. However you can also easily hide the tabs on the page control and add a TTabSet control to switch between the pages of the PageControl.

Here is some example code for doing that. In the form create add any pages from the page control to the TabSet and hide the individual tabs on the Page Control. Then in the TabSet OnChange event switch the active page on the PageControl.

procedure TForm3.FormCreate(Sender: TObject);
var
  i: integer;
begin

  for i := 0 to PageControl1.PageCount - 1 do
  begin
    TabSet1.Tabs.Add(PageControl1.Pages[i].Caption);
    PageControl1.Pages[i].TabVisible := false;
  end;

  TabSet1.TabIndex := 0;

end;

procedure TForm3.TabSet1Change(Sender: TObject; NewTab: Integer;
  var AllowChange: Boolean);
begin
  PageControl1.ActivePageIndex := NewTab;
end;
Mark Elder
  • 3,987
  • 1
  • 31
  • 47