?
Solved

TpageControl tab drawing example.

Posted on 2004-09-15
5
Medium Priority
?
1,090 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 2000 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 23

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 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