Form resize issue
-
Hi all, New to programing so forgive the basic question. I have created an app with a form that should fill the screen when loaded (its a big 1 screen app by requirement). I am using a 1280 x 1024 screen and I noticed that when I load it on a friends screen that the form window over fills the screen. I guess this is something to do with the different aspect ratios or something. Is there a way that I can make my app window dynamically shrink without lossing any info on the screen- I've tried anchoring the controls and locking them etc but when the parent form is resized they just get cut up. any help or a point in the right direction would be very much appreciated.
-
Hi all, New to programing so forgive the basic question. I have created an app with a form that should fill the screen when loaded (its a big 1 screen app by requirement). I am using a 1280 x 1024 screen and I noticed that when I load it on a friends screen that the form window over fills the screen. I guess this is something to do with the different aspect ratios or something. Is there a way that I can make my app window dynamically shrink without lossing any info on the screen- I've tried anchoring the controls and locking them etc but when the parent form is resized they just get cut up. any help or a point in the right direction would be very much appreciated.
Add a
TableLayoutPanel
to your form (Dock style: Fill) and then add your original controls to this. You will need to add rows and columns accordingly to accomodate everything but windows will ensure everything is correctly resized when your form changes at runtime. Regards Martin -
Hi all, New to programing so forgive the basic question. I have created an app with a form that should fill the screen when loaded (its a big 1 screen app by requirement). I am using a 1280 x 1024 screen and I noticed that when I load it on a friends screen that the form window over fills the screen. I guess this is something to do with the different aspect ratios or something. Is there a way that I can make my app window dynamically shrink without lossing any info on the screen- I've tried anchoring the controls and locking them etc but when the parent form is resized they just get cut up. any help or a point in the right direction would be very much appreciated.
Instead of setting a size, set it to maximise on startup. Yes, 1024x768 is a different aspect ratio to every other resolution known to man. But, there are also people with widescreen PCs now, so we can't assume *any* aspect ratio anymore.
darkturtle wrote:
I've tried anchoring the controls and locking them etc
Anchoring or docking them is really the only option apart from writing your own code to position everything.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Add a
TableLayoutPanel
to your form (Dock style: Fill) and then add your original controls to this. You will need to add rows and columns accordingly to accomodate everything but windows will ensure everything is correctly resized when your form changes at runtime. Regards MartinThanks Martin, Quick question- what is a TableLayoutPanel?? :-) My form consists of a number of controls I have designed myself that are set to a certain size (just are that way because of smallest test box size etc). When I add these to my form the form size fits perfectly in my window. Now when I load it on my friends PC the window is outside of the screen. I would like my form to resize everything (i.e. shrink it all) so that it fits in every windows format. Is this possible and is TableLayoutPanel the way to do it (I've looked on MSDN and cannot find a reference for it) Thanks very much for the reply.
-
Instead of setting a size, set it to maximise on startup. Yes, 1024x768 is a different aspect ratio to every other resolution known to man. But, there are also people with widescreen PCs now, so we can't assume *any* aspect ratio anymore.
darkturtle wrote:
I've tried anchoring the controls and locking them etc
Anchoring or docking them is really the only option apart from writing your own code to position everything.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
Christian, Thanks for the reply- 1024 x 768 is perfect for engineering work!!! But obviously is causing problems with my program. When I maximise on start up I still have the same problem- the form controls (my own designed controls) fit into my window but in my friends they get pushed together and overlap making them illegible. Do you know of anyway to shink them to size??? On my screen they are perfect size but on my friends they look huge!!! thanks for any help.
-
Christian, Thanks for the reply- 1024 x 768 is perfect for engineering work!!! But obviously is causing problems with my program. When I maximise on start up I still have the same problem- the form controls (my own designed controls) fit into my window but in my friends they get pushed together and overlap making them illegible. Do you know of anyway to shink them to size??? On my screen they are perfect size but on my friends they look huge!!! thanks for any help.
I use anchor for this all the time, it works a treat for me. From time to time, I've written code to manually move things, but rarely.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Thanks Martin, Quick question- what is a TableLayoutPanel?? :-) My form consists of a number of controls I have designed myself that are set to a certain size (just are that way because of smallest test box size etc). When I add these to my form the form size fits perfectly in my window. Now when I load it on my friends PC the window is outside of the screen. I would like my form to resize everything (i.e. shrink it all) so that it fits in every windows format. Is this possible and is TableLayoutPanel the way to do it (I've looked on MSDN and cannot find a reference for it) Thanks very much for the reply.
Hi, The TableLayoutPanel (I'm using VS2005 Pro, so I've assumed you are using it too, and hoping you have access to this form control!!) is in the "Toolbox" (i.e. where you find labels and textboxes and the like) under the "Containers" section. It works like a spreadsheet with rows and columns. What you need to do is dock your controls within the TableLayoutPanels cells (its obvious once youve dragged one onto your form).... Also reading this thread, Are some problems related to the size of the operating system font (i.e. Display Settings->Advanced === By default this will be "Normal". Perhaps your friends PC is set to Large or Extra Large) Regards, Martin