|
-
Dec 6th, 2008, 12:11 AM
#1
Thread Starter
Addicted Member
[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?
-
Dec 6th, 2008, 01:50 AM
#2
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.
-
Dec 6th, 2008, 05:44 PM
#3
Thread Starter
Addicted Member
Re: [2008] Maintain Control Location
Alright thanks, I got it to work
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|