Home All Groups Group Topic Archive Search About

Resize Tab control when windows form resizes

Author
1 Apr 2005 4:30 PM
BrianDH
Hi

I have a windows form and with init I have a tab control. 

How can I get the tab control to resize, Min/Max as the windows form is
resized?

Thanks

Author
1 Apr 2005 6:13 PM
Randall Arnold
In the Form's resize event code block, insert code changing the tab control's
dimensions relative to the form's.  Example:

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Resize
        TabControl1.Width = Me.Width - 20
        TabControl1.Height = Me.Height - 20
    End Sub

You can use any arithmetic operator and any values within reason; just
depends on what your needs are.

Randall Arnold

Show quoteHide quote
"BrianDH" wrote:

> Hi
>
> I have a windows form and with init I have a tab control. 
>
> How can I get the tab control to resize, Min/Max as the windows form is
> resized?
>
> Thanks
>
Author
1 Apr 2005 7:11 PM
BrianDH
It Works!  TY

Show quoteHide quote
"Randall Arnold" wrote:

> In the Form's resize event code block, insert code changing the tab control's
> dimensions relative to the form's.  Example:
>
>     Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Resize
>         TabControl1.Width = Me.Width - 20
>         TabControl1.Height = Me.Height - 20
>     End Sub
>
> You can use any arithmetic operator and any values within reason; just
> depends on what your needs are.
>
> Randall Arnold
>
> "BrianDH" wrote:
>
> > Hi
> >
> > I have a windows form and with init I have a tab control. 
> >
> > How can I get the tab control to resize, Min/Max as the windows form is
> > resized?
> >
> > Thanks
> >
Author
6 Apr 2005 11:16 AM
Phill. W
"BrianDH" <Bria***@discussions.microsoft.com> wrote in message
news:8C37B8C9-9A9A-4760-BF54-166510A05DB1@microsoft.com...
> How can I get the tab control to resize, Min/Max as the windows form
> is resized?

Take a look at the Anchor and Dock properties or, if neither of
those do the job, add some code to the Form's Layout event,
as in

Private Sub Form1_Layout( ...  ) handles Form1.Layout
    With TabControl2
        .Location = New Point( 8, 8 )
        .Size = New Size( Me.ClientSize.Width - 16 _
            Me.ClientSize.Height - 16 _
            )
    End With
End Sub

HTH,
    Phill  W.