简体   繁体   中英

Dock control to other one in WinForms

I have got MainForm with TabPage. On TabPage i have got three groupboxes next to one another. First is docked to left top, third to right top. everything is ok but if i maximize window , center textbox goes to bad position (is hide behing first groupbox) How dock this one to stay always between first and third groupbox?

You can accomplish this by using the Dock properties OR the anchor properties. Adding the groups boxes so they are ordered left to right:

Using the Dock properties:

`groupBox1.Dock = left`
`groupBox3.Dock = right`
`groupbox2.Dock = center`

Using the Anchor properties:

`groupBox1.Anchor = Top, Left`
`groupBox3.Anchor = Top, Right`
`groupbox2.Anchor = Top, Left, Right`

EDIT: In either case the center groupBox (groupBox2) should adjust to fill the space between the two outer groupboxes (groupBox1 and groupBox3)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM