Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 256411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:00:42+00:00 2026-05-11T22:00:42+00:00

I don’t know whether this question can be answered here, but I hope it

  • 0

I don’t know whether this question can be answered here, but I hope it will.
I wrote a simple text editor in Delphi 7 that serves as my primary IDE for writing C code under Windows. I run Windows in a VM and I needed something light.
In any case, it uses a TpageControl that gets a new tab whenever you open or create a new file. Pretty standard.
Now, the TPageControl under Delphi has no flat property.

NO I don’t mean setting the tab style to tsButtons or tsFlatButtons

the borders cannot be set to “none” and it looks pretty bad when you add a text editor into the tab control.

Is there any way to make a TpageControl flat?

EDIT:

On an open source PageControl that supports flat here’s what I found:

procedure TCustomTabExtControl.WndProc(var Message: TMessage);
begin
  if(Message.Msg=TCM_ADJUSTRECT) and (FFlat) then
   begin
    Inherited WndProc(Message);
    Case TAbPosition of
    tpTop : begin
    PRect(Message.LParam)^.Left:=0;
    PRect(Message.LParam)^.Right:=ClientWidth;
    PRect(Message.LParam)^.Top:=PRect(Message.LParam)^.Top-4;
    PRect(Message.LParam)^.Bottom:=ClientHeight;
  end;
    tpLeft : begin
    PRect(Message.LParam)^.Top:=0;
    PRect(Message.LParam)^.Right:=ClientWidth;
    PRect(Message.LParam)^.Left:=PRect(Message.LParam)^.Left-4;
    PRect(Message.LParam)^.Bottom:=ClientHeight;
  end;
    tpBottom : begin
    PRect(Message.LParam)^.Left:=0;
    PRect(Message.LParam)^.Right:=ClientWidth;
    PRect(Message.LParam)^.Bottom:=PRect(Message.LParam)^.Bottom-4;
    PRect(Message.LParam)^.Top:=0;
  end;
    tpRight : begin
    PRect(Message.LParam)^.Top:=0;
    PRect(Message.LParam)^.Left:=0;
    PRect(Message.LParam)^.Right:=PRect(Message.LParam)^.Right-4;
    PRect(Message.LParam)^.Bottom:=ClientHeight;
    end;
  end;
 end else Inherited WndProc(Message);

end;

The thing is when I tried something similar on the main application it won’t work. It won’t even compile.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:00:42+00:00Added an answer on May 11, 2026 at 10:00 pm

    When the tabs are drawn as buttons, no border is drawn around the display area, so set the Style property to tsButtons or tsFlatButtons. (For non-VCL programmers, this is equivalent to including the tcs_Buttons window style on the tab control.)

    An alternative is to use a TNotebook. It holds pages, but it doesn’t do any painting at all. You’d have to provide the tabs yourself, such as by setting the tab control’s height equal to the height of the tabs, or by using a TTabSet. (TTabSet is available in Delphi 2005; I’m not sure about Delphi 7.)

    Regarding the code you found, it would be helpful if you indicated why it doesn’t compile, or if you gave a link to where you found it, since I suppose the compilation error was because it refers to fields or properties of the custom class rather than the stock one. Here’s what you can try to put it in your own code, without having to write a custom control.

    Make two new declarations in your form like this:

    FOldTabProc: TWndMethod;
    procedure TabWndProc(var Msg: TMessage);
    

    In the form’s OnCreate event handler, assign that method to the page control’s WindowProc property:

    FOldTabProc := PageControl1.WindowProc;
    PageControl1.WindowProc := TabWndProc;
    

    Now implement that method and handle the tcm_AdjustRect messsage:

    procedure TForm1.TabWndProc(var Msg: TMessage);
    begin
      FOldTabProc(Msg);
      if Msg.Msg = tcm_AdjustRect then begin
        case PageControl1.TabPosition of
          tpTop: begin
            PRect(Msg.LParam)^.Left := 0;
            PRect(Msg.LParam)^.Right := PageControl1.ClientWidth;
            Dec(PRect(Msg.LParam)^.Top, 4);
            PRect(Msg.LParam)^.Bottom := PageControl1.ClientHeight;
          end;
        end;
      end;
    end;
    

    You can fill in the other three cases if you need them. Tcm_AdjustRect is a message identifier declared in the CommCtrl unit. If you don’t have that message in that unit, declare it yourself; its value is 4904.

    I suspect this doesn’t stop the control from drawing its borders. Rather, it causes the contained TTabSheet to grow a little bigger and cover up the borders.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know whether this is really possible, but I'm trying my best. If
I don't know if this question is trivial or not. But after a couple
Don't know if this is the right place to ask this, but I will
don't know better title for this, but here's my code. I have class user
Don't know why but I can't find a solution to this. I have 3
Don't know if I worded the question right, but basically what I want to
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this has been asked before, so point me to another question
Don't know if anyone can help me with this or if it's even possible.
Don't know a better title but here is what im trying to do. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.