Click here to Skip to main content
16,006,382 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i design application in visual c# in my laptop which its screen resolution 1280*800
and i disable maximize the form because i don't want the user to change the form size but the problem appears when i tried to run the application in my pc which its resolution 600*800 not all window
appears in the screen
so how can i use my application in any monitor resolution without change my design (distance between object (buttom ,textbox,....)
like window application.

thanks to all
Posted

Always maintain anchor position to each control to maintain the distance between two objects.


Each control has Anchor property in it. Your job would be to inspect it and use it properly. ;P
 
Share this answer
 
Using Control.Dock and Control.Anchor are how you can force controls to stay a certain distance away from its parent's edges, and you can use that to make GUIs that re-size nicely but I'm not sure that's what you're after.

How about one layout for a certain resolution and another layout for a different resolution? The Screen[^] class will tell you the resolution of what you're working on. You have to play around with you GUI to determine where you want your controls placed for each layout that you support, but once you know conceptually where you want things you can use the Control.Location and Control.Size properties to place them where you want and make them as big as you want based on the current Screen size.

An easier option is to set AutoScroll to true on your main form, amke your app as big as the screen if the screen is less than the expected size, and then the form will add scroll bars if not all of the controls are visible. The downside, of course, is that users will have to scroll to use your GUI.

That being said, I absolutely loathe programs that don't support resizing. I think it's incredibly user hostile when the programmer thinks they know better than I do how to use the real estate on my desktop. I'd recommend making your GUI re-sizable instead of locking it into one or several predefined sizes or adding scroll bars.
 
Share this answer
 
Your design is rubbish. You can't expect everyone to run at the resolution that suits you. Use the dock and anchor properties of form elements to make it so that the app organises itself for whatever resolution the user has. I use 1920x1200 and I'd be mad as hell if I had to run an app that small.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900