473,326 Members | 2,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to get screen width and height?

How to get screen width and height in C#?
--
Jurate
Nov 16 '05 #1
5 69800
Hi =?Utf-8?B?SnVyYXRl?=,
How to get screen width and height in C#?


Screen.PrimaryScreen.Bounds

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 16 '05 #2
Hi Jurate,

Screen.GetBounds() might help you out. I'm not sure if you will get the
entire virtual desktop on multi-screen systems, but in that case maybe
Screen.PrimaryScreen.GetBounds() will work.

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3
Jurate,

In addition to the above replies, if your application may be used on
multi-screen machines, you need to carefully consider any window sizing &
positioning etc that you do using screen bounds.

Consider whether you are moving windows or opening dialog boxes on a screen
other than the one which the user has positioned your application on (which
may not be the Primary screen). Try to avoid this if at all possible.

You can use Screen.AllScreens to get a list of all screens on the system.
You can then determine the bounds of each individual screen from the Bounds
property.

HTH,
Chris.

"Jurate" wrote:
How to get screen width and height in C#?
--
Jurate

Nov 16 '05 #4
Is there a way to determine which screen a particular window is displayed
upon?

"Chris Ballard" <Ch**********@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
Jurate,

In addition to the above replies, if your application may be used on
multi-screen machines, you need to carefully consider any window sizing &
positioning etc that you do using screen bounds.

Consider whether you are moving windows or opening dialog boxes on a screen other than the one which the user has positioned your application on (which may not be the Primary screen). Try to avoid this if at all possible.

You can use Screen.AllScreens to get a list of all screens on the system.
You can then determine the bounds of each individual screen from the Bounds property.

HTH,
Chris.

"Jurate" wrote:
How to get screen width and height in C#?
--
Jurate

Nov 16 '05 #5
Sorry for the delay.

I suspect you need to check the bounds of the window in question against the
Bounds or WorkingArea of each screen. Bear in mind that a window may be split
across more than one screen.

Cheers,
Chris.

"Rangi Keen" wrote:
Is there a way to determine which screen a particular window is displayed
upon?

"Chris Ballard" <Ch**********@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
Jurate,

In addition to the above replies, if your application may be used on
multi-screen machines, you need to carefully consider any window sizing &
positioning etc that you do using screen bounds.

Consider whether you are moving windows or opening dialog boxes on a

screen
other than the one which the user has positioned your application on

(which
may not be the Primary screen). Try to avoid this if at all possible.

You can use Screen.AllScreens to get a list of all screens on the system.
You can then determine the bounds of each individual screen from the

Bounds
property.

HTH,
Chris.

"Jurate" wrote:
How to get screen width and height in C#?
--
Jurate


Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Laura | last post by:
Hello, Newbie question: Does anyone know how to dynamically set the screen width in an applet? I have an applet that creates a horizontal bar menu on a webpage, and I would like the width to be...
14
by: delerious | last post by:
I need to determine an element's width and height in pixels (not including padding, border, and margin) in Javascript. The element will not have width or height styles specified. In Mozilla, I...
6
by: mgandra | last post by:
What is best way to find browser screen width using javascript that is compatible with all types of browsers.
2
by: Jim Ciotuszynski | last post by:
Anybody know where I can find an example or documentation on how to get and possibly set the width/height of the active browser's window. Thank in advance, Jim Ciotuszynski
1
by: Iyigun Cevik | last post by:
Using Request I can get some information about client. But I couldn't get two of them: 1. Screen Width ( and height ofcourse) 2. System Language. I can get them with JScript, but I don't want...
3
by: stan | last post by:
I have code that produces 5 boxes across the screen width. So far I have only tested it in IE 6 and NS 8. It works in IE, but in NS I am not able to fit in the 5th box. I am using two...
10
by: News | last post by:
I am trying to be able to manipulate the width and height of an <img> but do not seem to be able. "Yes", I know the JavaScript will "not" manip anything, which is ok. I simply do not know how to...
6
by: den | last post by:
same thing for the height parameter; for to set in the centre some popup with images what is better? what are the difference?
3
by: Safalra (Stephen Morley) | last post by:
(Note: I'm not trying to do anything stupid based on the user's screen size - I'm just curious.) At work today I was looking at the visitor statistics for a client website, and noticed that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.