How to make Usercontrol fill all Tabpage

Asked

Viewed 76 times

1

I am placing a Usercontrol inside a Tabpage. When not Maximized, the Usercontrol fills all Tabcontrol

inserir a descrição da imagem aqui

However, if I maximize the screen, there is a space on the right.

inserir a descrição da imagem aqui

I used usercontrol winforms "Anchor" or "Dock" property. So I tried the following

control.Dock = DockStyle.Fill
control.Dock = AutoScaleMode.None

I’ve tried too, but he only centralizes Usercontrol.

control.Anchor = AnchorStyles.None
control.Left = (tab.Width - control.Width) / 2
control.Top = (tab.Height - control.Height) / 2

1 answer

0


If you edit some property like Control.Top or Control.Anchor the property Dock will be discarded. Only edit property Dock control, nothing more.

control.Dock = DockStyle.Fill

If you touch the property Anchor after the Dock, the glue will be discarded.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.