Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to change the application's window size according to the resolution size of any monitor in C#

i have done a windows application and also i created a setup file for the same application in VS studio 2005.
When i install the application in any other system, the window state is maximised but i can only see, half of the side of my real window with controls which i use to see in my development system.
What can i do to change the windows size and controls present in the window to automatically change according to screen resolution of any system.s montior where i install my window's application

i came to know that SCREEN class in .Net will be helpful but not able to get any idea/conclusion with that class

i have developed in C# 2.0
Posted

C#
intX = Screen.PrimaryScreen.Bounds.Width;
intY = Screen.PrimaryScreen.Bounds.Height;


u can use above code get screen width and height

and then pass intx and inty to screen

C#
this.Width = intX ;
this.Height = intY ;
this.Refresh();


but for controls u have use some other way like Anchor codings.
pls refer following link

http://www.c-sharpcorner.com/UploadFile/harishankar2005/AnchoringinWindowsForms11302005051741AM
/AnchoringinWindowsForms.aspx

http://www.c-sharpcorner.com/UploadFile/c5c6e2
/dynamically-resizing-controls-on-windows-forms-using-ancho/

Thanks
AravindB
 
Share this answer
 
v2
C#
System.Drawing.Rectangle workingRectangle = 
			Screen.PrimaryScreen.WorkingArea;


This will fetch you the working area Height and width for the monitor.


C#
int widthVal=workingRectangle.Width;
int heightVal=workingRectangle.Height;



Best of luck.
 
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