zoukankan      html  css  js  c++  java
  • 获取屏幕的大小

    js获取屏幕的宽度 高度

    window.screen:包含有关客户的屏幕和显示性能的信息。
     window.screenX:窗口X坐标
    window.screenY:窗口Y坐标

                //我电脑的分辨率是1920*1080 也就是1920 height:1080 那么
    
                // 获取工作区域 。也就是高度不包括下面的任务栏  Windows需要添加引用 System.Windows.Forms
                int i = System.Windows.Forms.SystemInformation.WorkingArea.Width; //1920
                int b = System.Windows.Forms.SystemInformation.WorkingArea.Height; //1040
    
                //js获取工作区域的方法,
                window.screen.availHeight //1040
    
                window.screen.availWidth  //1920
    
                //以下结果相同。获取分辨率 。是屏幕的高度和宽度(包括任务栏高度)  Rectangle的命名空间:using System.Drawing;
                Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;
                int width = rect.Width; //1920
                int height = rect.Height; //1080
    
                System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.PrimaryScreen;
                System.Drawing.Rectangle rct = screen.Bounds;
                int k  = rct.Width; //1920
                int kk = rct.Height; //1080
  • 相关阅读:
    【Rust】文件操作
    【Rust】转义字符
    【Rust】原始标识符
    【Rust】字节数组
    【Rust】文档测试
    【Rust】外部函数接口
    【Rust】不安全操作
    【Rust】单元测试
    【Rust】集成测试
    WPF之ComboBox 安静点
  • 原文地址:https://www.cnblogs.com/nsky/p/3368511.html
Copyright © 2011-2022 走看看