zoukankan      html  css  js  c++  java
  • C#获取屏幕大小或任务栏大小

    使用SystemInformation类

    //当前的屏幕除任务栏外的工作域大小
    string currentScreenSize_OutTaskBar=SystemInformation.WorkingArea.Width.ToString() + "," +SystemInformation.WorkingArea.Height.ToString();
    MessageBox.Show("当前的屏幕除任务栏外的工作域大小为:"+currentScreenSize_OutTaskBar);

    //当前的屏幕包括任务栏的工作域大小
    string currentScreenSize=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width.ToString() + "," + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height.ToString();
    MessageBox.Show("当前的屏幕包括任务栏的工作域大小为:"+currentScreenSize);

    //任务栏大小
    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("任务栏大小:" + TaskBarSize.Width + "," + TaskBarSize.Height);

    作者:chlyzone
    出处:http://www.cnblogs.com/chlyzone/
    欢迎转载,请在文章页面明显位置给出原文连接。
  • 相关阅读:
    函数的内置方法
    函数
    文件操作
    三元运算
    流程控制
    集合
    div容器内文本对齐--神奇的css
    Struts2的零配置和rest插件
    MIME类型
    ganymed-ssh2使用
  • 原文地址:https://www.cnblogs.com/chlyzone/p/2754601.html
Copyright © 2011-2022 走看看