只能用客户端脚本来进行判断
好像是
window对像后面有个availwidth属性,你试试

解决方案 »

  1.   

    window.screen.width X window.screen.height
      

  2.   

    新建一个.aspx<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>GetClientScreen</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
    <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <script language=javascript>
    alert(window.screen.width  + "X" +window.screen.height )
    alert(window.screen.availWidth   + "X" +window.screen.availHeight )
    </script>
    </head>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    </form>
    </body>
    </html>运行一下就知道啦!
      

  3.   

    window.screen.availWidth   + "X" +window.screen.availHeight这是获得IE的工作区,不包括工具条
      

  4.   

    我怎么才能在服务器端得到这个值呢?我想在服务器端对这个值进行判断,以此来设定LABEL的字体大小。谢谢!
      

  5.   


    如果你只是要设定单个label的字体!
    你可以直接在客户端脚本里面判断了分辨率后设定label的字体的大小(当然也是在脚本里做)
      

  6.   

    可以这样做:
    1、首先在页面上建两个html控件:
    <INPUT id="Text1" style="BORDER-RIGHT: #9999cc thin solid; BORDER-TOP: #9999cc thin solid; Z-INDEX: 121; LEFT: 376px; BORDER-LEFT: #9999cc thin solid; WIDTH: 82px; BORDER-BOTTOM: #9999cc thin solid; POSITION: absolute; TOP: 14px; HEIGHT: 21px" type="text" size="8" value="1" name="Text1" runat="server">
    <INPUT id="Text2" style="BORDER-RIGHT: #9999cc thin solid; BORDER-TOP: #9999cc thin solid; Z-INDEX: 121; LEFT: 376px; BORDER-LEFT: #9999cc thin solid; WIDTH: 82px; BORDER-BOTTOM: #9999cc thin solid; POSITION: absolute; TOP: 14px; HEIGHT: 21px" type="text" size="8" value="1" name="Text2" runat="server">其中,runat="server"是在设计器中右击选作为服务器控件运行。用来存放分辩率。
    2、在客户端脚本中:
    window.document.all.item("Text1").value=screen.width;
    window.document.all.item("Text2").value=screen.height;
    这样,分辨率就存放在控件中了。
    注意:此脚本应放在aspx代码的底部,即</body>上端,否则在页面初始加载时因这两个控件还未生成,会报错。
    3、在服务器端代码需要用到的地方:
    string pagewidth=Request.Form["Text1"].ToString();
    string pageheight=Request.Form['Text2"].ToString();
    4、将这两个控件的z-index设为最小,如1,隐藏在其它控件底下,以免破坏页面。
    5、当然,分辨率也可以存放在其它类型的控件里,但上述控件是我已试验成功的。
      挺麻烦的吧,没办法。我现在就是这样做的,不过是用来隨着分辨率大小来调整image大小的。