Solved

TTabSheet

Posted on 2000-04-10
7
450 Views
Last Modified: 2010-04-04
How do you get a hold of the canvas of the tabsheet 'header'. By this I mean the little rectangle which 'TabSheet1' is usually written on when a new tabsheet is created. I am not referring to the 'body' of the tabsheet.
0
Comment
Question by:Diono
[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
7 Comments
 
LVL 6

Expert Comment

by:edey
ID: 2701962
I belive that actually "belongs" to the TPageControl

Gl
mike
0
 
LVL 1

Expert Comment

by:JoeBooth
ID: 2702056
Why do you need it?  If only to draw, you can set an imagelist on the page control and set the image index property of the appropriate tab sheet.

You can also control the font of the tabsheet individually...

If you need it for some other reason, I believe Mike is right about it's ownership.
0
 
LVL 2

Accepted Solution

by:
EdHillmann earned 50 total points
ID: 2702163
TPageControl has a public function called TabRect.  If you pass in the index of the tab sheet in question, it will return the TRect of the tab sheet you want.  For example, I have a form that contains one pagecontrol (with two tab sheets), and a button.  Here is my button click event...

procedure TForm1.Button1Click(Sender: TObject);
var
  vMyRect: TRect;
begin
  vMyRect := PageControl1.TabRect(0);
  PageControl1.Canvas.Brush.Color := clNavy;
  PageControl1.Canvas.FillRect(vMyRect);
end;


This will paint the rectangle of the first tab (not tab sheet) blue.

Fascinating. :)

Anyways, I think that's what you're after.  Good luck!

Ed

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:Epsylon
ID: 2702170
I think you're looking for TPageControl.OnDrawTab...
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2702403
Listening
0
 
LVL 4

Expert Comment

by:jeurk
ID: 2704553
Because of a lack of infos, let's say that I try a prediction too :
What you need is the function GetHitTestInfoAt(X, Y: Integer): THitTests;

Description

Call GetHitTestInfoAt to determine what portion of the tab control, if any, sits under the point specified by the X and Y parameters.

GetHitTestInfo returns a THitTests type. This set describes the possible elements under the mouse. When interpreting these values, each tab can be considered an “item” of the tab control.

THitTests is a set of THitTest values. THitTest can have any of the following values:

Value      Means the point is

htAbove      Above the client area.
htBelow      Below the client area.
htNowhere      Inside the control, but not on an item.
htOnItem      On an item, its text, or its bitmap.
htOnButton      On a button.
htOnIcon      On an icon.
htOnIndent      On the indented area of an item.
htOnLabel      On a label.
htOnRight      On the right side of an item.
htOnStateIcon      On a state icon or bitmap associated with an item.
htToLeft      To the left of the client area.
htToRight      To the right of the client area.

Or maybe You'll like the function IndexOfTabAt(X, Y: Integer): Integer;

So, Who's the most lucky of us ???
0
 
LVL 6

Expert Comment

by:edey
ID: 2704683
Hey Ed!
Great point, not something I've ever even *thought* about :)

Gl
Mike
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 106
Strange behavior when a form is closed 6 69
Print Graphic and Text to Epson TM-T88v 12 479
Sending files from  idTcpServer Socket to idTcpClient 2 53
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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