Resize Tab control when windows form resizes

G

Guest

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
 
G

Guest

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
 
G

Guest

It Works! TY

Randall Arnold said:
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
 
P

Phill. W

BrianDH said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top