locked
What are the standards used for resolution in Web.MobileForms? RRS feed

  • Question

  • User741646601 posted
    Hello, everyone I need to know what the patterns of settlement used to SmarthPhones and PocketPC and how to detect the diversion of a page to a resolution or another depending on the device or Smarthphone or PocketPC detected?

    If anyone can help me now thank you

    Translated from Portuguese to English by Google
    Friday, September 26, 2008 7:25 PM

All replies

  • User-2060689755 posted

    Hi LuizIta,

    We can GetSystemMetrics  to get mobile resolution. Like the code below:

    int height = GetSystemMetrics (SM_CYSCREEN);
    int width = GetSystemMetrics (SM_CXSCREEN);

    For more information:
    http://msdn.microsoft.com/en-us/library/aa929225.aspx

    For your second question, how to detect resolution change, you can handle Form_Resize event.

    Best regards,
    Guang-Ming Bian - MSFT

    Thursday, October 2, 2008 4:55 AM
  • User741646601 posted
     
    What is the name space or method I use on my mobile web forms in Visual Studio 2005

    is that when you try to use

    int height = GetSystemMetrics (SM_CYSCREEN);
    int width = GetSystemMetrics (SM_CXSCREEN);

    gave the following error

    Error 1 Name 'GetSystemMetrics' does not exist in the current context c: \ inetpub \ wwwroot \ meusite \ Default.aspx.cs 95 28 http://localhost/meusite/

    how to appreciate it now
     
     
     
    And since I do have an example that I could introduce myself to be in Csharp if possible

    If you can help me now thank you

    Translated from Portuguese to English by Google
    Thursday, October 2, 2008 3:59 PM
  • User-2060689755 posted

    Hi LuizIta,

    GetSystemMetrics is for windows form application, not asp.net. As far as I know, we can't use asp.net to get client screen resolution, but we can use javascript to get it.

    For more information:
    http://forums.asp.net/p/982704/1260093.aspx
    http://www.google.com/search?hl=en&q=asp.net+get+resolution&aq=f&oq

    Best regards,
    Guang-Ming Bian - MSFT

    Thursday, October 2, 2008 10:11 PM
  • User741646601 posted
    Got solve the problem of finding a resolution to Mobile Web Forms with the code below into Csharp ASP.NET MOBILE, still grateful now
     
    public partial class Device3 : System.Web.UI.MobileControls.MobilePage<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>{<o:p></o:p>    public int height;<o:p></o:p>    public int width;<o:p></o:p>    protected void Page_Load(object sender, EventArgs e)<o:p></o:p>    {<o:p></o:p><o:p> </o:p>        MobileCapabilities mc = (MobileCapabilities)Request.Browser;<o:p></o:p>        height = mc.ScreenPixelsHeight;<o:p></o:p>        width = mc.ScreenPixelsWidth;<o:p></o:p><o:p> </o:p>        Response.Write("height:"+height);<o:p></o:p>        Response.Write("<br/>width:"+width);<o:p></o:p>    }<o:p></o:p>
    }
     
    The result was that brought me this

    POCKET PC (iPHONES) = 240 RESOLUTION (height = 320 / width = 240)

    SmartPhone RESOLUTION = 240 = (height = 240 / width = 640)
     
    Thursday, October 2, 2008 10:17 PM