获取屏幕分辨率 [英] To Get Screen resolution

查看:140
本文介绍了获取屏幕分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的代码来获得屏幕分辨率



i used below code to get Screen resolution

var screen = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
       var width = System.Windows.Forms.SystemInformation.VirtualScreen.Width;
       var height = System.Windows.Forms.SystemInformation.VirtualScreen.Height;





它在本地系统中工作正常。当我将此代码托管给服务器时给出不同的分辨率



我的本地系统分辨率为1280x720

服务器给出的分辨率是1024x768





可以任何人帮我请急。



its working fine in local system.when i hosted this code to server its giving different resolution

My local system resolution is 1280x720
Server given resolution is 1024x768


Can Any one help me please urgent.

推荐答案

这是错误的方法,可能是基于错误的页面设计方法。您应该假设未知(并且用户可以随时更改窗口大小),而不是尝试为某些屏幕分辨率开发代码,因此,您应该以一种高度可接受的方式设计页面,而不是依赖它。特征。



请查看我过去的答案:

图像高度和宽度,单位为英寸 [ ^ ],

为Web应用程序设置标准屏幕分辨率 [ ^ ],

在ASP.net中获取客户机协议 [ ^ ],

< a href =http://www.codeproject.com/Answers/268403/screen-resolution-problems.aspx#answer1>屏幕分辨率问题。 [ ^ ],

在不同监视器中显示不同视图的网站 [ ^ ]。



尝试拥抱液体流体弹性网页设计。请看我过去的答案:

网页屏幕分辨率(Cross Browser \ Cross Platform)问题 [ ^ ]。



祝你好运,

-SA
This is wrong approach, probably based on wrong approach to the page design. Instead of trying to develop code for certain screen resolution, you should assume that is is unknown (and the user can change the window size anytime), so, instead of relying on it, you should design the page in a manner highly tolerable to such characteristics.

Please see my past answers:
Image Height and width in inches[^],
Set A Standard Screen Resolution For Web Application[^],
Get Client Machine Resolution in ASP.net[^],
screen resolution problems.[^],
website display with different view in different monitor[^].

Try to embrace liquid, fluid or elastic Web page design. Please see my past answer:
Webpage screen resolution (Cross Browser\Cross Platform) problem[^].

Good luck,
—SA


这篇关于获取屏幕分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆