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
  • 相关阅读:
    sql基础笔记备忘
    论坛---挂掉的思考
    http response
    跑步肋骨下方疼
    Golang
    svn rollback: 恢复到上一版本
    中国时区
    crontab
    初识redis
    siege
  • 原文地址:https://www.cnblogs.com/nsky/p/3368511.html
Copyright © 2011-2022 走看看