Page 1 of 2

Keep controls in place when going to and from fullscreen

Posted: Mon Sep 01, 2014 3:16 am
by jtlusco
I am looking for a way to keep a text box in the same spot on a form but re-size for fit when going in and out of full screen
*Update demo project to include image file in resources folder*

Re: Keep controls in place when going to and from fullscreen

Posted: Mon Sep 01, 2014 4:10 am
by CodenStuff
Have you tried using the anchor property?

Re: Keep controls in place when going to and from fullscreen

Posted: Mon Sep 01, 2014 8:25 am
by Codex
jtlusco wrote:
I am looking for a way to keep a text box in the same spot on a form but resize for fit when going in and out of full screen
If you don't want it to follow any corners then turn off the default top-left anchor. Adding anchor makes the control "stick" or follow the movement of the form when its size changes

Re: Keep controls in place when going to and from fullscreen

Posted: Mon Sep 01, 2014 8:37 am
by comathi
Yup! Anchor seems to be the property you want to be using.

Image

MSDN link

Re: Keep controls in place when going to and from fullscreen

Posted: Mon Sep 01, 2014 3:25 pm
by jtlusco
The Anchor property does not do what I need.I have added a demo of what I am trying to do when you start the app the textbox is the size. shape, and in the correct place on the form when you go to full screen the textbox is no longer in the same place on the forms graphic I hope this clarifies my question.

Re: Keep controls in place when going to and from fullscreen

Posted: Tue Sep 02, 2014 4:41 pm
by Codex
I understand what you mean now. I don't have access to the actual image (since it's a local resource) but you could try this:

Place a panel, with the background same as the picture, and resize it to fill the form. Then place the textbox within the panel and fix the anchor to: Left, Right, Bottom.
For the Panel, change the Anchor to Top, Left, Right, Bottom (Don't dock it)

I'm not sure whether this works, but it's worth a try.

Re: Keep controls in place when going to and from fullscreen

Posted: Tue Sep 02, 2014 5:46 pm
by jtlusco
I have Updated demo project to include image file in resources folder along with the settings you suggest.

Re: Keep controls in place when going to and from fullscreen

Posted: Wed Sep 03, 2014 10:46 am
by Codex
Quick reply #jtlusco, did it work ? I'm on my mac atm and can't check it. I can test-run it at home on my PC (w/ Windows)

Re: Keep controls in place when going to and from fullscreen

Posted: Wed Sep 03, 2014 2:39 pm
by jtlusco
No It did not work for me.

Re: Keep controls in place when going to and from fullscreen

Posted: Wed Sep 03, 2014 7:11 pm
by clanc789
Maybe set a maximum with of the textbox? I dont know if that works?