?
Solved

Get device screen dimensions

Posted on 2007-11-30
3
Medium Priority
?
813 Views
Last Modified: 2013-12-21
Anyone know how to get a device's screen dimensions programmatically?
0
Comment
Question by:DotNetThinker
[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
3 Comments
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 1200 total points
ID: 20385602
for simple queries you can use System.Windows.Forms.Screen class

if you need something towards screen resolution, you can use Win32 API ChangeDisplaySettingsEx(). There are few useful wrappers for C# which you can google easily
0
 
LVL 63

Assisted Solution

by:Fernando Soto
Fernando Soto earned 800 total points
ID: 20385608
Hi DotNetThinker;

Here is how you can get the screen dimensions.

            Screen pScreen = Screen.PrimaryScreen;
            Rectangle bounds = pScreen.Bounds;
            MessageBox.Show("Width = " + bounds.Width + "\n" +
                "Height = " + bounds.Height);

If you have multiple screens then you can get an array of Screens by using AllScreens and loop through each one.

The documentation for Screens can be found at:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.screen_members.aspx

Fernando
0
 
LVL 11

Author Closing Comment

by:DotNetThinker
ID: 31412038
Thanks guys
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 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