Board index » delphi » Removing the border of a PageControl

Removing the border of a PageControl

How do I hide/remove the border of a PageControl? There is no BorderStyle property...

thanks

 

Re:Removing the border of a PageControl


Quote
"\"MisterZ\" Nomail" wrote:

> How do I hide/remove the border of a PageControl? There is no BorderStyle property...

        There will be no border if you set the Style property to tsButtons or
tsFlatButtons.  This changes the appearance of the tabs, but it doesn't
really make sense visually to remove the border while the tabs are
showing as tabs, so I'm presuming that you want to hide the border when
no tabs are showing.

        HTH,

        -Craig

--
Craig Stuntz            Vertex Systems Corporation
Senior Developer        http://www.vertexsoftware.com

Re:Removing the border of a PageControl


Set the style to tsButtons or tsFlatButtons, and set each page's TabVisible
property to false. In some versions of Delphi the tabs will not diasppear
until runtime. If you want to be able to manipulate the tabs at design time
and you are using a version of Delphi that hides the tabs at design time,
then set the TabVisible properties in the OnCreate event of the form.

Note that if you are using the tab control as a subform holder and you have
a lot of controls and pages, you might want to consider replacing the
tabcontrol with a blank panel, put each page of controls in a separate
frame, then just load the appropriate frame into the panel at runtime based
on user selection. This method saves resources, lets your program load
faster, and allows you to segment the logic for each subform (or tab page)
by having the code for each page in a separate unit, rather than all jumbled
into the main form.

If you decide to do this, the code for displaying a frame in a panel at
runtime is...

// clear the panel
while DisplayPanel.controlcount > 0 do DisplayPanel.Controls[0].free;
// display the frame
with MyFrame do
begin
    Parent := DisplayPanel;
    Visible := true;
    Align := alClient;
end;

There is one more subtle advantage to this. If you're embedding the tab
contol in another panel, you'll find that even when you hide all the tabs,
there's still a few pixels of unusable space on the tab control around the
border that you can't get rid of. With frames, you can go right to the edge.
Not a problem unless you're creating an MS Outlook type app and want a grid
on one of the tabs to go right to the edge of the tab control.

Nigel Shaw

Quote
<MisterZ Nomail> wrote in message news:393542e4@dnews...

> How do I hide/remove the border of a PageControl? There is no BorderStyle
property...

> thanks

Re:Removing the border of a PageControl


You are presuming right. Thanks for the hint.

Quote
Craig Stuntz <cstuntz@no_spam.vertexsoftware.com> wrote:

>"\"MisterZ\" Nomail" wrote:

>> How do I hide/remove the border of a PageControl? There is no BorderStyle property...

>    There will be no border if you set the Style property to tsButtons or
>tsFlatButtons.  This changes the appearance of the tabs, but it doesn't
>really make sense visually to remove the border while the tabs are
>showing as tabs, so I'm presuming that you want to hide the border when
>no tabs are showing.

>    HTH,

>    -Craig

>--
>Craig Stuntz                Vertex Systems Corporation
>Senior Developer    http://www.vertexsoftware.com

Re:Removing the border of a PageControl


I am indeed using the page control as a form holder. I am out of luck with
frames because I am using D4. I am using forms instead.They are
loaded/unloaded as needed as you said. I took the idea from an article in
Delphi Informant.

I am building a MS outlook like app and I did notice the pixel problem
around the page control. I cannot use only a frame and embed my forms at
runtime when necessary. I want to keep my main form loaded in memory so the
app does not reload the data every time. It would be too much time
consuming.

Thank you for your help.

Stephane aka MisterZ

Quote
Nigel Shaw <ns...@wildplan.com> wrote in message news:39367d84@dnews...
> Set the style to tsButtons or tsFlatButtons, and set each page's
TabVisible
> property to false. In some versions of Delphi the tabs will not diasppear
> until runtime. If you want to be able to manipulate the tabs at design
time
> and you are using a version of Delphi that hides the tabs at design time,
> then set the TabVisible properties in the OnCreate event of the form.

> Note that if you are using the tab control as a subform holder and you
have
> a lot of controls and pages, you might want to consider replacing the
> tabcontrol with a blank panel, put each page of controls in a separate
> frame, then just load the appropriate frame into the panel at runtime
based
> on user selection. This method saves resources, lets your program load
> faster, and allows you to segment the logic for each subform (or tab page)
> by having the code for each page in a separate unit, rather than all
jumbled
> into the main form.

> If you decide to do this, the code for displaying a frame in a panel at
> runtime is...

> // clear the panel
> while DisplayPanel.controlcount > 0 do DisplayPanel.Controls[0].free;
> // display the frame
> with MyFrame do
> begin
>     Parent := DisplayPanel;
>     Visible := true;
>     Align := alClient;
> end;

> There is one more subtle advantage to this. If you're embedding the tab
> contol in another panel, you'll find that even when you hide all the tabs,
> there's still a few pixels of unusable space on the tab control around the
> border that you can't get rid of. With frames, you can go right to the
edge.
> Not a problem unless you're creating an MS Outlook type app and want a
grid
> on one of the tabs to go right to the edge of the tab control.

> Nigel Shaw

> <MisterZ Nomail> wrote in message news:393542e4@dnews...

> > How do I hide/remove the border of a PageControl? There is no
BorderStyle
> property...

> > thanks

Other Threads