Windows Mobile adaptive resolution

Source: Internet
Author: User

See: http://msdn.microsoft.com/zh-cn/magazine/dvdarchive/cc546609.aspx

 

Excerpt:

 

The Windows Mobile 6 SDK provides two main resources for compiling a resolution awareness application using local code: Reusable screenlib class and deviceresolutionaware. h header in the uilayout example. The uilayout example can be found in the/samples/common/CPP/Win32 Directory of the Windows Mobile SDK. Deviceresolutionaware. H is installed in the/VC/CE/atlmfc/include directory of Microsoft Visual Studio installation directory. Screenlib provides a set of help functions to align elements on the screen. For example, you can use the dockcontrol function to dock a given control to an edge of the screen or all four edges to fill the client area. The optimizewidth and optimizeheight functions align a widget (or multiple controls-for the optimizewidth function) with the monitor and adjust its size, leaving a small margin between the left and right, or between the top and bottom. Other functions provided can be used to align controls and adjust a group of controls to the same size. Among these functions, screenlib may be the most useful when a large number of forms-based applications are used. Deviceresolutionaware. H makes up for the shortcomings of screenlib, and provides more than 20 functions and macros that help build more complex adaptive applications. First, it can provide getdisplaymode (display features and functions) and other adaptive user interfaces provide basic functions and macros for block construction. You will see scalex, scaley, scalerect, and scalept, which are the appropriate scaling values for the current resolution. Next, we will help you scale the image (such as stretchicon and imagelist_stretchbitmap) based on the currently displayed features, as well as functions that can be used to automatically adjust the layout of the dialog box when the direction changes, such as relayoutdialog. Screenlib and deviceresolutionaware. h lay a solid foundation for building a local Resolution Awareness application. At the same time, you must note that they are not a substitute for the design and solution that may be unique to your environment, especially when directly interacting with the display buffer or building a complex UI.

 

Resolution Awareness for hosted applications for hosted code applications, Microsoft. NET Compact framework provides a set of display attributes that help you create a resolution awareness application. Similar to the functions in screenlib,. NET Compact framework provides the control. Dock attribute that binds a specified control to the edge of its parent item. Control. Anchor provides a similar function by binding a control to a fixed distance from its parent edge. If the display cannot accommodate controls in the form, the scroll bar is automatically added using the control. autoscroll attribute. In addition, Control. autoscale tracks the design resolution of the form and dynamically scales the form when the DPI or resolution is changed. As expected, the control. autoscale attribute is useful for simple forms. However, as forms become more complex, their functions become increasingly limited. For complex forms, these attributes provide a starting point, but they are not necessarily a complete solution, especially when you start to dynamically adjust the direction. One way is to use orientation aware control (OAc). The Microsoft mode and implementation solution team has published it as part of the mobile client software factory (msdn2.microsoft.com/library/aa480471. OAC provides a simple method for multiple directions, especially for forms-based applications. After installing OAc, you can use the managed forms designer in Visual Studio to first arrange the UI in portrait mode, and then use OAC rotation in Landscape mode. You can adjust the UI as needed. OAC will track changes so that end users can use the appropriate layout when running in portrait or Landscape mode. However, OAc also has some drawbacks. First, in essence, OAc allows you to design a combination of specific directions and resolutions. This method is not encouraged because the supported directions and resolutions may change in the future. Second, it does not allow you to clearly design different dpi or Square screens. Square screens have recently become popular on Windows Mobile standard-based smartphone devices. Finally, because OAC creates and manages multiple la s for each screen, the performance decreases significantly when you add more forms and increase complexity (in extreme cases, this will significantly increase the startup time of your application ). Due to these drawbacks, the Windows Mobile Team has always encouraged developers to avoid using OAC. This team is about to release Windows Mobile line of business accelerator (go.microsoft.com/fwlink /? A new version of linkid = 115317), which includes a component that helps build a resolution awareness application. The resolution awareness application contains a single UI and uses docking, locating, and other technologies.

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.