Choosing colors

The Window painter has two Color drop-down toolbars on PainterBar3 that display colors you can use for the background and foreground of components of the window. Initially, the drop-down toolbars display these color selections:

NoteDo not use Windows system colors for deployed applications The Windows system colors are those defined by the user in the desktop Windows Control Panel. They are labeled with letters that indicate the type of display element they represent. As they are not defined for the Windows CE device, you should not use them in the applications you build with PocketBuilder.

Defining custom colors

You can define your own custom colors for use in windows, user objects, and DataWindow objects.

Figure 11-2: Dialog box for defining custom colors

The sample displays the Color dialog box. At top left is an area labeled Basic colors with eight columns and six rows of boxes displaying basic colors. Below it is a Custom colors area of sixteen boxes in two rows and a button labeled Define Custom Colors that is grayed out in the picture. At right is the Color Matrix, a large rectangle that displays the selected color, and next to it a narrow slider for adjusting the color in the matrix. Below the matrix is a small display box labeled Color / Solid. Next to the display box are text boxes with values for Hue, Saturation, Luminosity, Red, Green, and Blue. At bottom right is an Add to Custom Colors button.

StepsTo define and maintain custom colors:

  1. Select Design>Custom Colors from the menu bar.

    The Color dialog box displays.

  2. Click in an empty color box in the list of custom colors.

  3. Choose an existing color or create the color you want.

    You can start with one of the basic colors and customize it in the palette to the right by dragging the color indicator with the mouse. You can also specify precise values to define the color.

  4. When you have the color you want, click Add to Custom Colors.

    The new color displays in the list of custom colors.

  5. Select the new color in the list of custom colors.

  6. Click OK.

    The new color displays in the Color drop-down toolbars and is available in all windows, user objects, and DataWindow objects you create.

PocketBuilder saves custom colors in the [Colors] section of the PocketBuilder initialization file, so they are available across sessions.

Specifying foreground and background colors

You can assign colors to controls using the PainterBar or the Properties view. The page in the Properties view that you use to assign colors depends on the control.

For some controls you can change the background color only. For others, including the CommandButton, PictureButton, PictureHyperLink, Picture, ScrollBars, TrackBars, and ProgressBars, you can change neither the foreground nor the background color.

StepsTo assign a color using the PainterBar:

  1. Select the control.

  2. Select either the foreground or background color button from the PainterBar.

  3. Select a color from the drop-down toolbar.