In my current project I have a problem when I add my usercontrol into the panel of splitcontainer. I managed to add it to the middle of the panel with the following code:
ucFactuur ucFactuur = new ucFactuur();
ucFactuur.Location = new Point(
splitContainer1.Panel2.ClientSize.Width / 2 - ucFactuur.Size.Width / 2,
splitContainer1.Panel2.ClientSize.Height / 2 - ucFactuur.Size.Height / 2);
ucFactuur.Anchor = AnchorStyles.None;
splitContainer1.Panel2.Controls.Add(ucFactuur);
But now my scrollbar is gone, it is there when I remove the AnchorStyles.None but then when I resize the window it doesn’t stay in the middle (It’s in a fixed position).

I’m uncertain how to resolve this problem, nor can I find any other way to dynamically center my usercontrol.
Thanks,
Thomas
Anchoring.Nonewon’t work in this situation since it only works when there are no scrollbars. But once you have scrollbars, you don’t want the control centered anymore, you need it positioned against the scroll value.In other words, I think you have to handle the resizing yourself:
Then your setup would change to this: