?
Solved

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

Posted on 2011-03-03
5
Medium Priority
?
954 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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