C # obtain the screen size or taskbar size

Source: Internet
Author: User

Use the SystemInformation class

[Csharp]
// The size of the Work Field on the current screen except the taskbar
String currentScreenSize_OutTaskBar = SystemInformation. WorkingArea. Width. ToString () + "," + SystemInformation. WorkingArea. Height. ToString ();
MessageBox. Show ("the size of the Work Field on the current screen except the taskbar is:" + currentScreenSize_OutTaskBar );
 
// The current screen contains the size of the work field of the taskbar
String currentScreenSize = System. windows. forms. screen. primaryScreen. bounds. width. toString () + "," + System. windows. forms. screen. primaryScreen. bounds. height. toString ();
MessageBox. Show ("the current screen includes the job field size of the taskbar:" + currentScreenSize );
 
// Taskbar size
Size OutTaskBarSize = new Size (SystemInformation. WorkingArea. Width, SystemInformation. WorkingArea. Height );
 
Size ScreenSize = new Size (System. Windows. Forms. Screen. PrimaryScreen. Bounds. Width, System. Windows. Forms. Screen. PrimaryScreen. Bounds. Height );
 
Size TaskBarSize;
 
TaskBarSize = new Size (
(ScreenSize. Width-(ScreenSize. Width-OutTaskBarSize. Width )),
(ScreenSize. Height-OutTaskBarSize. Height)
);
 
MessageBox. Show ("Taskbar size:" + TaskBarSize. Width + "," + TaskBarSize. Height );

 


From Ouyang Xiaoyan

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.