Solved

TpageControl tab drawing example.

Posted on 2004-09-15
5
1,085 Views
Last Modified: 2008-02-01
I am looking for an example of how to draw a TpageControl tab (user draw)
Thanks
Amiel
0
Comment
Question by:amielDorel
  • 2
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 12067795


Take a look at this thread (not already PAQ but the posted code does the trick)
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21037452.html
0
 

Author Comment

by:amielDorel
ID: 12068990
Thanks it works,  how about painting the border of the tab?    is it posible to set an image to cover the tab ?
Thanks again
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12069676
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(ARect);
  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(ARect);
  control.Canvas.TextRect(ARect,ARect.Left+2,ARect.top+1,
                         TPageControl(Control).Pages[TabIndex].Caption);
  Control.Canvas.StretchDraw(rect,Application.icon);//this paints the app.icon on every tab. If you use a appropriate bitmap you can have a nice effect
end;
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12073814
just to follow this thread . . . currently no time for coding  . . . meikl ;-)
0
 

Author Comment

by:amielDorel
ID: 12077813
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
 
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now