[RESOLVED] [2008] Maintain Control Location
Hi. Is there any way I can make a control on a form stay in the same position from all sides when I resize the window? For example, if I have a radiobutton in the middle of the form and then I maximize the form. The radio button will no longer be in the middle.
Anchoring doesn't seem to work for location, as I think it only alters a control's size. So is there any way I can make my controls stay in the same position relative to the size of the window?
Re: [2008] Maintain Control Location
What you're asking for is possible but can be tricky. The first possibility is handling the SizeChanged event of your form and manually calculating the correct position for the control. It's just a bit of simple maths.
The second option is to use a TableLayoutPanel. You can add a TLP to the form and dock it. You then add three rows and three columns. The first and last of each are set to 50% and the middle of each is set to autosize. You stick the control in the centre cell and it will stay centred in the form as it resizes.
The problem comes if you have other controls on the form.
Re: [2008] Maintain Control Location
Alright thanks, I got it to work :D