Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
500 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (8)


PageControl without borderGo to Tommy Andersen's websiteFormat this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi all versions
Category:
N/A
Skill Level:
Scoring:
Last Update:
09/23/2003
Search Keys:
delphi delphi3000 article borland vcl code-snippet PageControl without border AdjustClientRect
Times Scored:
4
Visits:
4699
Uploader: Tommy Andersen
Company: EasyWare
Reference: N/A
 
Question/Problem/Abstract:
PageControl's is easy to use when designing different pages inside a form, but the anoying border around the control makes it hard to design Windows2000 like menus etc.

Install the unit enclosed here, and the use the new PageControl instead of your old. As you can see we override the AdjustClientRect to prevent setting the internal border of the control.

Btw. If you have a form with lot's of components you can view the form as text, then change all TPageControl's to TEasyPageControl for faster changes.
Answer:



unit EasyPageControl;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls;

type
  TEasyPageControl = class(TPageControl)
  private
    { Private declarations }
    fTabHeight : Integer;

    Procedure SetTabHeight(NewTabHeight: Integer);
  protected
    { Protected declarations }
  public
    { Public declarations }
    Constructor TEasyPageControl.Create(AOwner: TComponent); override;

    Procedure AdjustClientRect(var Rect: TRect); override;
  published
    { Published declarations }
    Property TabHeight: Integer read fTabHeight write SetTabHeight;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('EasyWare', [TEasyPageControl]);
end;

Constructor TEasyPageControl.Create(AOwner: TComponent);
Begin
   Inherited;

   fTabHeight := 0;
End;

Procedure TEasyPageControl.AdjustClientRect(var Rect: TRect);
Begin
   IF (csDesigning in ComponentState) Then
   Begin
      Inherited AdjustClientRect(Rect);
   End
    Else Rect.Top := Rect.Top + fTabHeight;
End;

Procedure TEasyPageControl.SetTabHeight(NewTabHeight: Integer);
Begin
   IF (NewTabHeight <> fTabHeight) Then
   Begin
      fTabHeight := NewTabHeight;
      Invalidate;
   End;
End;

End.





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Tabs disappear in D7
    Matteo Riso (Sep 21 2003 2:19PM)

I tried this unit but I lost tabs. Is it normal?
Respond

RE: Tabs disappear in D7
Tommy Andersen (Sep 22 2003 10:03AM)

Hi,
I haven't tried it with Delphi 7, but it's probably because of the AdjustClientRect procedure.

Try changing to the following, and see if it works:


Procedure TEasyPageControl.AdjustClientRect(var Rect: TRect);
Begin
   IF (csDesigning in ComponentState) Then
   Begin
      Inherited AdjustClientRect(Rect);
   End
    Else Rect.Top := Rect.Top + 20; // This must equal the size of the tab
End;

Respond

RE: RE: Tabs disappear in D7
Matteo Riso (Sep 22 2003 4:15PM)

IT WORKED WELL!

Now I can rate it :)

Thank you very much.
Respond

RE: RE: RE: Tabs disappear in D7
Tommy Andersen (Sep 23 2003 8:49AM)

Good to hear! :)
Was 20 the proper size of the tab, or should it be smaller/larger?
Respond

RE: RE: RE: RE: Tabs disappear in D7
Matteo Riso (Sep 23 2003 9:03AM)

I think 20 is the right size, but I could test it with higher values.
Respond

RE: RE: RE: RE: RE: Tabs disappear in D7
Tommy Andersen (Sep 23 2003 9:15AM)

Ok.
Could you please post a comment of your results for other readers when you have the results ready?
Respond

RE: RE: RE: RE: RE: RE: Tabs disappear in D7
Matteo Riso (Sep 23 2003 9:32AM)

When applying XP manifest in order to paint the control with Xp visual styles, some themes use to paint also a region of the tabsheets. Using 26 as tab  size will show this region.

I think you should put a custom property to let user choose the tab size that fits his needings.
Respond

RE: RE: RE: RE: RE: RE: RE: Tabs disappear in D7
Tommy Andersen (Sep 23 2003 9:55AM)

I changed it right now. Don't have the possibility to verify it right now.Hope it solves your task.
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
Hans Gulö
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)