What I have:
I have a panel (the white space), and two DataGridViews represented by the green and blue squares. The panel is anchored to take up most of the center of my screen, and grows/shrinks with the window size.
What I need:
I would like the green square to always stay with it's right border in the middle of the screen and take up the left half of the screen. Equally, I'd like the blue square to stay with its left border in the middle and to take up the right half of the screen.
Basically, I just want it to always look like this image regardless.
Do I need to do this programmaticly? I can't seem to find a combination of anchoring or docking that makes this happen, and adding more panels as containers yields the same issue in the end.
Not sure if this is what you want:
Creating a SplitContainer on the screen.
Anchor = Top, Bottom, Left, Right
IsSplitterFixed = True (Trick)
Creating another two datagridviews, each a side inside the SplitterContainer
Dock = Fill
I generally use a TableLayoutPanel
to accomplish this. It is very easy to use (a simple introduction can be found here).
You create to cells in the first row and set it to 50% width each. In each cell you put one DataGrid
and you set their Dock
'ing to Fill
.
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