Silverlight获取屏幕分辨率

Silverlight获取屏幕分辨率,第1张

概述/// <summary>     /// 浏览器屏幕信息类     /// </summary>     public class Browser     {         /// <summary>           /// During static instantiation, only the Netscape flag is checked           /// </summ

/// <summary>
   
/// 浏览器屏幕信息类
   
/// </summary>
    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");            }        }    }

总结

以上是内存溢出为你收集整理的Silverlight获取屏幕分辨率全部内容,希望文章能够帮你解决Silverlight获取屏幕分辨率所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1026551.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存