Using PictureButtons

A PictureButton is identical to a CommandButton in its functionality. The only difference is that you can specify a picture to display on the PictureButton. The picture can be a PocketBuilder stock icon or a BMP, GIF, animated GIF, JPEG, or PNG file.

NoteUsing JPEG or PNG image files Unlike BMP and GIF images, which can reside in a PocketBuilder resource file (PKR) or in a database blob, JPEG and PNG images must reside in the file system. You must deploy JPEG or PNG files to the current application directory or include the full path of the deployed image files that you want to use in a Pocket PC device or emulator.

PNG files are not supported on the desktop, only on Pocket PC devices and emulators. You cannot add a PNG file to a picture button control in the PocketBuilder UI, only in script. For example:

pb_1.PictureName = "\Program Files\my_pic.png"

You can choose to display one picture if the button is enabled and a different picture if the button is disabled.

Use these controls when you want to be able to represent the purpose of a button with a picture instead of text.

StepsTo specify a picture:

  1. Select the PictureButton to display its properties in the Properties view.

  2. On the General properties page, enter the name of the image file you want to display when the button is enabled, or use the Browse button and choose a file.

  3. Enter the name of the image file you want to display when the button is disabled, or use the Browse Disabled button and choose a file.

    If the PictureButton is defined as initially enabled, the enabled picture displays in the Layout view. If the PictureButton is defined as initially disabled, the disabled picture displays in the Layout view.

StepsTo specify button text alignment:

  1. Select the PictureButton to display its properties in the Properties view.

  2. On the General properties page, enter the text for the PictureButton in the Text box.

  3. Use the HTextAlign and VTextAlign lists to choose how you want to display the button text.