amielDorel
asked on
TpageControl tab drawing example.
I am looking for an example of how to draw a TpageControl tab (user draw)
Thanks
Amiel
Thanks
Amiel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
well, in that link there's an addition by meikl about the tab border
BTW it's possible also to draw some images using the canvas methods...
here a dirty example just to explane how it can work:
procedure TForm1.PageControl1DrawTab (Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var ARect : TRect;
begin
ARect := Rect;
//clear complete
control.Canvas.brush.Color := clBtnFace;
control.Canvas.FillRect(AR ect);
InflateRect(ARect,-2,-2);
//decide the color
if active then
control.Canvas.brush.Color := clRed
else
control.Canvas.brush.Color := clBtnFace;
//paint the tab
control.Canvas.FillRect(AR ect);
control.Canvas.TextRect(AR ect,ARect. Left+2,ARe ct.top+1,
TPageControl(Control).Page s[TabIndex ].Caption) ;
Control.Canvas.StretchDraw (rect,Appl ication.ic on);//this paints the app.icon on every tab. If you use a appropriate bitmap you can have a nice effect
end;
BTW it's possible also to draw some images using the canvas methods...
here a dirty example just to explane how it can work:
procedure TForm1.PageControl1DrawTab
TabIndex: Integer; const Rect: TRect; Active: Boolean);
var ARect : TRect;
begin
ARect := Rect;
//clear complete
control.Canvas.brush.Color
control.Canvas.FillRect(AR
InflateRect(ARect,-2,-2);
//decide the color
if active then
control.Canvas.brush.Color
else
control.Canvas.brush.Color
//paint the tab
control.Canvas.FillRect(AR
control.Canvas.TextRect(AR
TPageControl(Control).Page
Control.Canvas.StretchDraw
end;
just to follow this thread . . . currently no time for coding . . . meikl ;-)
ASKER
Hi,
i could not find a code example for updating tab's frame.
As far as painting the tab, I found a problem, trying to paint a tab that has the tabvisible property setup for false.
Thanks
Amiel
i could not find a code example for updating tab's frame.
As far as painting the tab, I found a problem, trying to paint a tab that has the tabvisible property setup for false.
Thanks
Amiel
ASKER
Thanks again