Board index » cppbuilder » TTabSheet color...

TTabSheet color...


2004-02-23 02:03:29 AM
cppbuilder14
how can i change the color of my TTabSheets within TPageControl?
Regards
JP
 
 

Re:TTabSheet color...

"Joćo Pereira" < XXXX@XXXXX.COM >wrote in message news:4038eeeb$ XXXX@XXXXX.COM ...
Quote
how can i change the color of my TTabSheets within TPageControl?
Create an 'access class', it's purpose is to redeclare
protected properties as public.
class TTabSheetAccessClass : public TTabSheet
{
public: __property Color;
};
Then you cast your TTabSheet ptr to set the color property:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
((TTabSheetAccessClass*)TabSheet1)->Color = clBlue;
}
Todd
 

Re:TTabSheet color...

With BCB>= 5: write an event handler for the OnDrawTab event:
void __fastcall TForm2::PageControl1DrawTab(TCustomTabControl *Control,
int TabIndex, const TRect &Rect, bool Active)
{
Control->Canvas->Font->Color = clGreen;
::SetTextAlign(Control->Canvas->Handle, TA_CENTER);
Control->Canvas->TextRect(Rect, (Rect.Left + Rect.Right)/2,
Rect.Top + 2, PageControl1->Pages[TabIndex]->Caption.c_str());
}
Good luck,
Bernhard Hoyler
 

{smallsort}