IOT Virtual Conference - Register now to book your ticket and get updates
x
CONGRATULATIONS! C# Corner Q1, 2021 MVPs Announced
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
Rajkumar R
1.8k
183
191.6k
How to get monitor width and height in C# windows app?
Sep 5 2014 2:04 AM
Hi,
My machine in windows-7 & Screen resolution is (1366 * 768) Highly recommended.
float height = SystemInformation.VirtualScreen.Height;
float width = SystemInformation.VirtualScreen.Width;
double diagonal = Math.Sqrt(width * width + height * height);
The above code I have used to get width and height of the screen to calculate diagonal in windows application. But the problem here is when I change the resolution width and height also gets change. So I need a piece of code that should read height and weight to calculate diagonal size.
Please post solution for this post.
Thanks in Advance.
Reply
Answers (
5
)
users login/logout times on my site.
Attempted to read or write protected memory.