1

Possible Duplicate:
WinForms Different DPI Layouts

I have made an application which uses high number of pictureboxes in a windows form. I have successfully completed the project. But my problem started when i deployed the application onto my friends laptop which has a smaller display screen. Not all pictureboxes and controls were visible. i.e. some controls went out-of form and were inaccessable.

Actually I had developed the application on my desktop which has larger display screen. How do I make the form portable so that inspite of display screen variation, the controls are correctly displayed?

I know it is a simple problem of Normalized co-ordinates...But I dont want to sit down and plan the co-ordinates (like : Screen 1unit length and 1 unit breadth. So 1st conrtol at 0.25,0.3 position) coz it will waste my time as the application has vast pictureboxes and controls.

Isnt there a tool in Visual studio which will automatically use normalized co-ordinates and maintain it in the deploy file so that it is portable?????

Community
  • 1
  • 1
killerCoder
  • 407
  • 2
  • 8
  • 14
  • Duplicates: http://stackoverflow.com/questions/5296810/how-can-i-make-my-winforms-application-dpi-aware , http://stackoverflow.com/questions/1850915/winforms-different-dpi-layouts and http://stackoverflow.com/questions/196606/net-2-0-winform-supporting-dpi-and-default-font-changes – Magnus Johansson Jul 16 '11 at 19:41
  • @Magnus: so just vote to close it ... – genesis Jul 16 '11 at 19:42
  • @genesis, which I did. The comment is only to highlight other questions. – Magnus Johansson Jul 16 '11 at 19:44
  • You don't want to do any work: just set the form's AutoScroll property to True. Friends' response: "works, but that's kinda lame dude!". Allow the window to be resized at will, that fixes the resolution problem too. It's not that hard. – Hans Passant Jul 16 '11 at 21:09

3 Answers3

3

There is a tool. Its called WPF. It has device independant graphics which renders the same, regardless of the size.

Other then that, you will have to manually normalize it yourself

Icemanind
  • 47,519
  • 50
  • 171
  • 296
3

use TableLayoutPanel and position your controls within the cells of the table, which will care on resizing

use Anchor/Docking property of controls for correct relative alignment.

Regards.

Tigran
  • 61,654
  • 8
  • 86
  • 123
  • TableLayoutPanel will only help control the position of things. It won't affect the size at all – Icemanind Jul 16 '11 at 19:50
  • actually the post talks about positioning of controls and not resizing of them – Tigran Jul 16 '11 at 19:52
  • from msdn : "The TableLayoutPanel control arranges its contents in a grid. Because the layout is performed both at design time and run time, it can change dynamically as the application environment changes. This gives the controls in the panel the ability to proportionally resize, so it can respond to changes such as the parent control resizing or text length changing due to localization." http://msdn.microsoft.com/en-us/library/system.windows.forms.tablelayoutpanel.aspx – Tigran Jul 16 '11 at 19:54
1

Have you looked at using a FlowLayoutPanel with the AutoSize property enabled? You can build it so its dynamically sized at runtime.

Brandon Moretz
  • 7,512
  • 3
  • 33
  • 43