Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get device screen dimensions

Posted on 2007-11-30
3
Medium Priority
?
814 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 64

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

609 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