PictureListBox

A PictureListBox, like a ListBox, displays available choices in both text and images. You can specify that PictureListBoxes have scroll bars if more choices exist than can be displayed in the PictureListBox at one time.

Adding images to a PictureListBox

You can choose from a group of stock images provided by PowerBuilder, or use any bitmap (BMP) file, icon (ICO) file, GIF file, or JPEG file when you add images to a PictureListBox.

Keep in mind, however, that the images should add meaning to the list of choices. If you use a large number of images in a list, they become meaningless.

You could, for example, use images in a long list of employees to show the department to which each employee belongs, so you might have a list with 20 or 30 employees, each associated with one of five images.

StepsTo add an image to a PictureListBox:

  1. Select the PictureListBox control to display its properties in the Properties view, and then select the Pictures tab.

    The Pictures property page displays.

  2. Use the PictureName drop-down ListBox to select stock pictures to add to the PictureListBox

    or

    Use the Browse button to select a bitmap (BMP) file, icon (ICO) file, GIF file, or JPEG file to include in the PictureListBox.

    NoteAbout cursor files To use a cursor file, you must type the file name. You cannot select it.

  3. Specify a picture mask color (the color that will be transparent for the picture).

  4. Specify the height and width for the image in pixels or accept the defaults.

    The sample shows the Pictures tab of the Properties view for a Picture List Box control.  At top is a list of Picture Names numbered 1 through three. Icons and picture names display in the first two lines, along with a drop down list box and a browse button. Below Picture Names are drop down list boxes labeled Picture Mask Color, Picture Width, and Picture Height. Transparent is displayed as the Mask Color and the last two drop downs are set to ( Default ).
  5. Repeat the procedure for the number of images you plan to use in your PictureListBox.

  6. Select the Items tab and change the Picture Index for each item to the appropriate number.

    The sample shows the Items tab of the Properties view for a Picture List Box control.  At top is a list labeled Items that has lines numbered 1 through three and two columns labeled Text and Picture Index. Happy and one are the sample values for item one, and Sad and 2 are the values shown for item two.
  7. Click OK.

On the Items tab page, you can work with rows in this way:

To

Do this

Select a row

Click the row button on the left, or with the cursor in the edit box, press Shift+Space

Delete a row

Select the row and press Delete

Move a row

Click the row button and drag the row where you want it or press Shift+Space to select the row and then press Ctrl+Up Arrow or Ctrl+Down Arrow to move the row

Delete text

Click the text and select Delete from the pop-up menu

On the Pictures tab page, you can work with rows in the same way, and also:

To

Do this

Browse for a picture

Select the row and click the Browse button or press F2

For information about other properties, right-click in any tab page in the Properties view and select Help from the pop-up menu.