Using the Resource Editors

In the toolkit, as in Visual C++, resource editors enable you to create and modify resources. Windows CE supports the following kinds of resource:

Accelerator tables Icons
Bitmaps Menus
Cursors Message table entries
Dialog boxes String table entries
Fonts Version data
HTML pages  

The toolkit does not support the toolbar resource editor for the Hot Key, Animation, Rich Edit, IP Address, or ComboEx controls.

You can use the Visual Studio ResourceView tab to view or edit your project resources. The ResourceView tab does not appear if your project has no resources.

    To edit a resource

  1. Select the Visual Studio ResourceView tab to see a list of the resources in your project.
  2. Select a resource. The resource appears in a new window along with the appropriate resource editor. For example, if you select a bitmap, the bitmap appears in a new window along with the bitmap editor.
  3. Edit your resource using the tools provided by the specified resource editor.

The toolkit customizes the resource editors so that they work with Windows CE resources. Specifically, the toolkit modifies the resource editors so that they can perform the following tasks:

In Windows CE, version 1.0, the toolkit converts color resources to 4-color (2-bit, monochrome) during the linking process. Because applications using versions 2.0 and later of the Windows CE operating systems support 8-bit color, color resources for these applications do not require conversion.

    To create a 4-color bitmap or icon

  1. Choose New on the File menu.
  2. Choose the Files tab.
  3. Enter the name of the bitmap or icon in the File Name text box.
  4. Choose Bitmap File to create a bitmap or Icon File to create an icon, and then choose OK. A blank bitmap or icon appears in a new window along with the appropriate resource editor.
  5. Use the resource editor to create a bitmap or icon.

    – Or –

    Import a bitmap by choosing Resource from the Visual Studio Insert menu, then choose a bitmap or resource and choose Import.

  6. To convert a bitmap, choose Convert to 4-Color on the Image menu.

    – Or –

    To convert an icon, double-click New Device Image and add the two 4-color image sizes to your icon.

You also can modify existing bitmaps to a 4-color format.

    To convert a bitmap to a 4-color format

  1. Open the image in the resource editor.
  2. Double-click the empty area of the left image pane to open the Bitmap Properties dialog box.
  3. Choose a number in the Colors drop-down box. Select the number 4 to convert the bitmap to a 4-color image.

Note Do not keep two separate image source pools to develop for emulation and remote targets at the same time. If the link flags are set correctly, the images convert automatically between 4-color and 16-color bitmaps during linking.

Windows CE uses the Tahoma font by default. You can add this font to your application’s dialog boxes. You also can add an OK button to a dialog box.

    To add the standard Windows CE font or an OK button to a dialog box

  1. Choose the Visual Studio ResourceView tab, and then choose a dialog box.
  2. Double-click the dialog box image to open Dialog Properties.
  3. To add a font, choose the Font button on the General tab, and select the Tahoma font.

    – Or –

    To add an OK button, select the Caption Bar OK (WCE only) check box on the Extended Styles tab. The OK button is not visible in the resource editor, but it will appear in the dialog box after the application is built.

Note Windows NT uses 16 x 15 bitmaps on its button bars, while Windows CE uses 16 x 16 bitmaps. Adjust the image size to 16 x 16 when designing images for use on Windows CE button bars.

Because MFC for Windows CE does not support the stock Win32 OLE font and color property pages, you cannot use the dialog editor to set fonts or colors for an MFC for Windows CE control. Use the long integer RGB values to specify a color. Use the control or container to specify a font during run time.