I have made a window in which I will be having two groups/panels and some buttons in between them. I want to code the resizing behavior in a way that when the window expands, the two panels increase their widths while keeping the distance between them constant.
Please see this mockup:
As you see above, I want the 'Local' and 'Server' Panels to resize while keeping the distance in between them same. If I use anchors (Top+Left+Right+Bottom), the left panel will overlap the right one and the right's width one will go out of the window. I want them to share the increased width of the window equally.
As for the buttons in between, I have kept ancors as Top only. By removing Left anchor from button, it automatically places itself in the center of the window when window is expanded, which is just the way I want it to be.
Any ideas how to manage resizing of panels?
Thanks.
Visual Basic .NET (VB.NET) is a multi-paradigm, object-oriented programming language, implemented on the .NET Framework.Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language.
VB.Net is a simple, modern, object-oriented computer programming language developed by Microsoft to combine the power of .NET Framework and the common language runtime with the productivity benefits that are the hallmark of Visual Basic. This tutorial will teach you basic VB.Net programming and will also take you...
1. C is a programming language for general purpose computers; VB is an event driven programming language that was designed to make computer programming easier for programming beginners. 2. C is an imperative systems implementation language; VB does not have the possibility of multiple assignment,...
This tutorial will teach you basic VB.Net programming and will also take you through various advanced concepts related to VB.Net programming language. This tutorial has been prepared for the beginners to help them understand basic VB.Net programming.
Use the TableLayoutPanel control.
First add the TableLayout to the Form and set its Dock() property to Fill. Next you'll need to setup 3 columns and two rows. Add the two buttons to the middle column with each one is in its own row. Afterwards, setup the column values so they are like this: Leave the rows at 50% on both. Now add your two GroupBoxes to the 1st and 3rd columns in the 1st row. For both GroupBoxes, set Dock() to Fill, and RowSpan() to 2. For the top Button, turn on only the Bottom Anchor. For the bottom Button, turn only the Top Anchor. For the TableLayoutPanel, set Padding() to 5,5,5,5.
Here is what it looked like when I was all done:
Resize the window and observe how the controls behave...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With