Solved

how can i get screen width and height in my C#.net window application ??

Posted on 2011-03-03
5
919 Views
Last Modified: 2012-06-27
i want to know that how can i get screen width and height in my C#.net window application ??
because i want to use it in form location ...

for ex.

       
 Form objForm = this.findform();
        objForm.Location = new Point(screen_width / 4 , screen_height / 4);

Open in new window


so can u tell me how can i get screen width and height in my C#.net window application ??
0
Comment
Question by:Parth48
5 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 35024886
You would use:
            int screen_width = Screen.PrimaryScreen.Bounds.Width;
            int screen_height = Screen.PrimaryScreen.Bounds.Height;

Open in new window

0
 
LVL 8

Expert Comment

by:jimsweb
ID: 35024902
Though the below link doesn't directly deal with your question, I am pretty sure that it has answer that you are looking for. :)

http://social.msdn.microsoft.com/Forums/en/Vsexpressvcs/thread/aba4d7cb-8114-4018-bff0-582756c0ae70
0
 
LVL 10

Expert Comment

by:Asim Nazir
ID: 35024982
0
 
LVL 14

Expert Comment

by:Dhanasekaran Sengodan
ID: 35025559
0
 
LVL 15

Expert Comment

by:Russell_Venable
ID: 35035515
Why not just  this.width and this.height as anonymous calls to the application. It's one the ways I use to dynamically change the shape/size of my applications or controls.

This will authomatically inherit your main windows methods. So you can define them like so
this.Height = 220;
this.Width = 220;

Simple enough or grab the values.

Double saveHeight = this.Height;
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now