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:

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:

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.

StepsTo define and maintain custom colors:

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

    The Color dialog box displays.

    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. 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. At bottom right are a small display box labeled Color / Solid and boxes with values for Hue, Sat, Lum, Red, Green, and Blue. At bottom right is an Add to Custom Colors button.
  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.

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.