zoukankan      html  css  js  c++  java
  • silverlight browse information

      public class Browser
        {        /// <summary>           /// During static instantiation, only the Netscape flag is checked      
            /// /// </summary>      
            /// 
            static Browser()
            {
                _isNavigator = HtmlPage.BrowserInformation.Name.Contains("Netscape");
            }
            /// <summary>           /// Flag indicating Navigator/Firefox/Safari or Internet Explorer           /// </summary>   
            private static bool _isNavigator;
            /// <summary>           /// Provides quick access to the window.screen ScriptObject           /// </summary>         
            /// 
            private static ScriptObject Screen
            {
                get
                {
                    ScriptObject screen = (ScriptObject)HtmlPage.Window.GetProperty("screen");
                    if (screen == null)
                    {
                        throw new InvalidOperationException();
                    } return screen;
                }
            }
            /// <summary>           /// Gets the window object's client width           /// </summary>      
            public static double ClientWidth
            {
                get
                {
                    return _isNavigator ? (double)HtmlPage.Window.GetProperty("innerWidth")
                        : (double)HtmlPage.Document.Body.GetProperty("clientWidth");
                }
            }
            /// <summary>           /// Gets the window object's client height           /// </summary>    
            public static double ClientHeight
            {
                get
                {
                    return _isNavigator ? (double)HtmlPage.Window.GetProperty("innerHeight")
                        : (double)HtmlPage.Document.Body.GetProperty("clientHeight");
                }
            }
            /// <summary>           /// Gets the current horizontal scrolling offset           /// </summary>         
            /// 
            /// 
            public static double ScrollLeft
            {
                get
                {
                    return _isNavigator ? (double)HtmlPage.Window.GetProperty("pageXOffset")
                        : (double)HtmlPage.Document.Body.GetProperty("scrollLeft");
                }
            }
            /// <summary>      
            /// Gets the current vertical scrolling offset           /// </summary>    
            /// 
            public static double ScrollTop
            {
                get
                {
                    return _isNavigator ? (double)HtmlPage.Window.GetProperty("pageYOffset")
                        : (double)HtmlPage.Document.Body.GetProperty("scrollHeight");
                }
            }
            /// <summary>           /// Gets the width of the entire display           /// </summary>         
            public static double ScreenWidth
            {
                get
                {
                    return (double)Screen.GetProperty("width");
                }
            }
            /// <summary>           /// Gets the height of the entire display           /// </summary>       
            public static double ScreenHeight
            {
                get
                {
                    return (double)Screen.GetProperty("height");
                }
            }
            /// <summary>           /// Gets the width of the available screen real estate, excluding the dock           /// or task bar           /// </summary>   
            /// 
            /// 
            public static double AvailableScreenWidth
            {
                get
                {
                    return (double)Screen.GetProperty("availWidth");
                }
            }
            /// <summary>           /// Gets the height of the available screen real estate, excluding the dock           /// or task bar           /// </summary>     
            /// 
            /// 
            public static double AvailableScreenHeight
            {
                get
                {
                    return (double)Screen.GetProperty("availHeight");
                }
            }
            /// <summary>           /// Gets the absolute left pixel position of the window in display coordinates           /// </summary>       
            public static double ScreenPositionLeft
            {
                get
                {
                    return _isNavigator ? (double)HtmlPage.Window.GetProperty("screenX")
                        : (double)HtmlPage.Window.GetProperty("screenLeft");
                }
            }         /// <summary>           /// Gets the absolute top pixel position of the window in display coordinates           /// </summary>     
            public static double ScreenPositionTop
            {
                get
                {
                    return _isNavigator ? (double)HtmlPage.Window.GetProperty("screenY")
                        : (double)HtmlPage.Window.GetProperty("screenTop");
                }
            }
        }
  • 相关阅读:
    LR--用栈实现移进--归约分析(demo)
    阿里云ECS服务器socket无法连接的问题
    select客户端模型封装——回调方式快速建立客户端
    select服务器端模型封装——回调方式快速建立服务端
    python实现的ocr接口
    汉字字典树
    linux下简易端口扫描器
    Linux下cs简单通讯(socket)
    POj 1321 棋盘问题 DFS 回溯
    HDU 1097 快速幂
  • 原文地址:https://www.cnblogs.com/akingyao/p/3156428.html
Copyright © 2011-2022 走看看