Windows Phone 8 adapts to multi-screen resolution

Source: Internet
Author: User



Windows Phone 8 compared to Windows Phone 7 There are many features and performance improvements such as support for multi-core cups, support SD card, a variety of resolutions, obviously WP7 WVGA-480X800 has not fully meet the needs of users, many users like large screen high-resolution Mobile phone, with the advent of the large-screen mobile phone WP8 is also supporting the large-resolution screen "wxga-768x1280 and 720p-720x1280"



I've talked to you about the application of WP8 multiple resolutions, but maybe some of you don't know how to determine the resolution of the current phone and how to make the application adapt to the current phone resolution today I give you a detailed introduction.



There are three screen resolutions supported by Windows phone 8, such as the following:






Which we can clearly see WVGA and WXGA screen width ratio is 15:9, only in the case of 720P is 16:9 of this to remind you that some applications may need to special treatment of 720P cases such as some pictures or video class applications.



Also believe that many students want to achieve full screen or change the system time battery icon color Please use Systemtray to set:





void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            ProgressIndicator progress = new ProgressIndicator
            {
                IsVisible = true,
                IsIndeterminate = true,
                Text = "Downloading details..."
            };
            SystemTray.SetProgressIndicator(this, progress);
            SystemTray.BackgroundColor = System.Windows.Media.Colors.Red;
            SystemTray.ForegroundColor = System.Windows.Media.Colors.Blue;
            //SystemTray.IsVisible = false;
        }


Through the above method can hide the status bar or according to the style applied to adjust the style of tray, personal feeling more practical here to introduce you.



Of course today's focus is on multi-resolution support the following is a way to implement a Resolutionheper class to determine the current screen resolution:


public enum Resolutions { WVGA, WXGA, HD720p };

public static class ResolutionHelper
{
   private static bool IsWvga
   {
      get
      {
         return App.Current.Host.Content.ScaleFactor == 100;
      }
   }

   private static bool IsWxga
   {
      get 
      { 
         return App.Current.Host.Content.ScaleFactor == 160; 
      }
   }
     
   private static bool Is720p
   {
      get 
      { 
         return App.Current.Host.Content.ScaleFactor == 150; 
      }
   }

   public static Resolutions CurrentResolution
   {
      get
      {
         if (IsWvga) return Resolutions.WVGA;
         else if (IsWxga) return Resolutions.WXGA;
         else if (Is720p) return Resolutions.HD720p;
         else throw new InvalidOperationException("Unknown resolution");
      }
   }
}





The above code is used in the System.Windows.Interop


public int scalefactor {get;}





The scale factor is the current application content area.



The screen resolution is judged by the screen scale.



In addition, in different resolution of the phone need to use the corresponding splashscreenimage.jpg file to fit the screen perfectly, otherwise the system will automatically zoom.






Windows Phone 8 adapts to multi-screen resolution


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.