473,765 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get screen width and height?

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


Screen.PrimaryS creen.Bounds

--
Greetings
Jochen

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

Screen.GetBound s() 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.PrimaryS creen.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.AllScree ns 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**********@d iscussions.micr osoft.com> wrote in message
news:74******** *************** ***********@mic rosoft.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.AllScree ns 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**********@d iscussions.micr osoft.com> wrote in message
news:74******** *************** ***********@mic rosoft.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.AllScree ns 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
8307
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 100%. Unfortunately, this doesn't work with Explorer. so, in my html page, I wrote a function like this: <SCRIPT LANGUAGE="JavaScript"> int function getScreenWidth()
14
21541
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 know I can use document.defaultView.getComputedStyle() to do this. IE does not support document.defaultView.getComputedStyle(). It supports offsetWidth/offsetHeight, but those include the padding and border. IE also supports...
6
5525
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
1583
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
1793
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 to submit a form to get these information. Is there any other possible way?
3
2175
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 different style sheets, one for IE and on e for NS. The box widths are set to 20%. I would appreciate suggestions on how to get the 5 boxes to fit the screen
10
3307
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 capture the width or height. Once I can do that I can manipulate them. Here is the HTML for the <img> <div class="ImgMnp" id="myImg" onmouseover="imgSize('myImg','fpImg)"> <img src="images/FirePlace.jpg" width="480" height="640" id="fpImg" />
6
7606
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
6795
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 the recorded screen resolutions included results that clearly referred to dual display systems - 2560 by 1024, for example. The statistics package is obtaining this data from window.screen.width. I wasn't aware of this behaviour of...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.