wince UI 定制
WinCE 的UI是skinnable。
Recently, while preparing for a talk at an Embedded event, a bullet point in my presentation seemed to beg for elaboration: the skinnable UI for Microsoft® Windows® CE .NET. I had talked to this point at a number of conferences, but had spent little time playing with the code to produce a customized UI. Since I had a few moments in the speaker lounge (and also an article to write), it seemed a good time to take a look at how the UI can be customized for Windows CE. On my wish list: customized screen colors, Windows controls that don''t look like they belong to Windows, an OK/Close button in the non-client area that looks like a smiley face, a replacement shell (perhaps based on Microsoft® Internet Explorer 5.5 browser), and a shiny bike with basket and bell for Christmas...
Okay, so on with the article; let''s see what''s lurking beneath the hood of the Windows CE UI.
Windows CE .NET 提供为你的嵌入式设计定制用户界面的能力。如 POS terminals, ATM machines, or other ''fixed function'' devices。也可以用Internet 浏览器和应用程序.以前版本的WINCE也可以定制用户界面,但带有明显的WINDOWS外观和感觉。现在WINCE 。NET改变了这个。
这里有一些选择,在为一个Windows CE .NET 设备定制界面时:
·使用 Microsoft Internet Explorer 作为设备的shell. 这是一个非常弹性的选择。使用HTML(和DHTML)编制高度定制化的用户界面是快速的,简单的和弹性的。可以充分利用位图,动画,动态。
·创建一个独立的应用程序来取代标准shell。在概念上,这个和使用IE是类似的。是一个很好的选择在一个功能单一的设备上,如点销售终端(point-of-sale terminal)上。 It''s possible to change the appearance of controls within an application by subclassing the control, which is achieved through GetWindowLong( ) and SetWindowLong( ) API''s. (Feel free to check out any of the number of articles on MSDN that discuss subclassing.)
·在操作系统里改变某些用户界面组件的外观。可以通过改变位图和代码来实现。
Microsoft在Windows CE .NET中提供了2种皮肤: Windows 95 外观和Windows XP 外观. 这些分别为通用控件,windows控件,和非客户区提供windows外观。“皮肤”文件 在下面文件夹处:
\WINCE420\PUBLIC\COMMON\OAK\DRIVERS\SKINNABLEUI.
在skinnableui 文件夹下提供的代码可以改动(因为是在public树下),可以被你的设备所采用。
Take a look in the skinnableui folder. There are two sets of user interface components: GWE/COMMCTRL (Windows 95 appearance) and GWEXP/COMMCTRLXP (Windows XP).
Here''s how we choose which of the ''skins'' is applied to our device:
1.Build an operating system image using the default catalog options; this will give a Windows 95 appearance.
2.从catalog里选择Windows XP skin。在 Core O/S/Display Based Devices/Shell and User Interface/User Interface/Customizable UI/Windows XP-like sample skin. 加这个组件到平台里,或者设置the SYSGEN_XPSKIN 环境变量.
How do these skins differ? Let''s take a look at some of the UI differences. We can then take a look at how to further customize the Windows CE .NET user interface.

Figure 1. Windows 95 外观,使用标准皮肤。

Figure 2. Windows XP 外观, 使用XP-风格皮肤。
Let''s now examine how we modify the Windows CE .NET user interface. This includes:
·Changing the user interface colors.
·Modifying user interface bitmaps.
·Modifying Windows CE .NET controls appearance.
·Modifying standard UI dialogs (for instance, Startupwhich can be used to show device configuration or password screen, Out of Memory, and Touch Screen Calibration).
·Using Internet Explorer as the shell of our device.
Changing the User Interface Colors
One of the quickest and simplest ways to modify the appearance of a device is to modify some or all of the user interface colors. This is achieved through the registry. Note that the default system colors are not visible in the devices registry. To set colors to something other than the default system colors, we need to override the color map in the registry. The easiest way to do this is to build an operating system image using Platform Builder, download the image to either the emulation environment or to a reference board, use the control panel to modify the color scheme to match the colors you require for your device, and then use the remote registry editor to take a snapshot of the updated colors from the registry—after all, who wants to spend time guessing RGB values? The color map can be found in the following registry location: HKEY_LOCAL_MACHINE\SYSTEM\GWE\SysColor.
If we were to modify the system color map on a device (or emulator) and use Remote Registry Editor to extract a .REG file, here''s how the extracted .REG file might look. Once we''ve extracted the registry information we can then add this to our Project.REG file and rebuild our platform to take advantage of the new color scheme.
[HKEY_LOCAL_MACHINE\SYSTEM\GWE]
 
推荐文章 |
