Board index » delphi » TPageControl & TTabSheet

TPageControl & TTabSheet

I would like change color of active page of my TPagecontrol.
How can I do this ?

Thanks.

 

Re:TPageControl & TTabSheet


Do you want to change the color of the tab or of the page ?

1. You can change the color of the tab by setting TPageControl.OwnerDraw to
True and implementing TPageControl.OnDrawTab to draw the active tab in a
different color.

2. You can change the color of the pages by setting the protected property
Color at runtime, e.g.:

type
  TMyTabSheet = class(TTabSheet);

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  for i := 0 to PageControl1.PageCount - 1 do
    TMyTabSheet(PageControl1.Pages[i]).Color := clRed;
end;

"FEUILLET Thomas" <thomas.feuil...@conex.fr> schreef in bericht
news:8giojc$mn4$1@news.mc2.net...

Quote
> I would like change color of active page of my TPagecontrol.
> How can I do this ?

> Thanks.

Re:TPageControl & TTabSheet


I would not change color of the page but only then color of title tabsheet
and I use Delphi 3 not Delphi 5.
The first solution is good for me but TPageControl.OwnerDraw doesn't exists
in D3.

M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
8giq5o$5j...@porthos.nl.uu.net...

Quote
> Do you want to change the color of the tab or of the page ?

> 1. You can change the color of the tab by setting TPageControl.OwnerDraw
to
> True and implementing TPageControl.OnDrawTab to draw the active tab in a
> different color.

> 2. You can change the color of the pages by setting the protected property
> Color at runtime, e.g.:

> type
>   TMyTabSheet = class(TTabSheet);

> procedure TForm1.FormCreate(Sender: TObject);
> var
>   i: Integer;
> begin
>   for i := 0 to PageControl1.PageCount - 1 do
>     TMyTabSheet(PageControl1.Pages[i]).Color := clRed;
> end;

> "FEUILLET Thomas" <thomas.feuil...@conex.fr> schreef in bericht
> news:8giojc$mn4$1@news.mc2.net...
> > I would like change color of active page of my TPagecontrol.
> > How can I do this ?

> > Thanks.

Other Threads