Choosing colors

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

  • 20 predefined colors

  • 16 custom colors (labeled C)

  • The full set of Windows system colors

Windows system colors

The Windows system colors display in the same order as in the TextColor and BackColor lists in the Properties view for a control. They are labeled with letters that indicate the type of display element they represent:

  • W for windows

  • T for text in windows, title bars, menus, buttons, and so on

  • A for the application workspace

  • B for button face, highlight, shadows, and borders

  • S for scroll bars

  • D for the desktop

  • M for menu bars

  • F for window frames

  • H for highlight

  • L for links

The Windows system colors are those defined by the user in the Windows Control Panel, so if you use these colors in your window, the window colors will change to match the user's settings at runtime.

Defining custom colors

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

To 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.

    PowerBuilder saves custom colors in the [Colors] section of the PowerBuilder 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 depends on the control. For some controls you can change only the background color, and for others you can change neither the foreground nor the background color. These controls include CommandButton, PictureButton, PictureHyperLink, Picture, ScrollBar, TrackBar, ProgressBar, and OLE controls.

To 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.