Compartir a través de


How to: Enhance Control Display

Command buttons, check boxes, and option buttons can display pictures in addition to captions. These controls all have properties that make it possible for you to specify pictures to be displayed on the controls.

Property

Description

DisabledPicture

Display picture on button when button is disabled.

If you do not specify a value, Visual FoxPro displays a dimmed picture when the control is disabled.

DownPicture

Display picture on button when button is pressed.

If you do not specify value, Visual FoxPro displays the picture with the background colors changed so that the button appears pressed when the button is pressed.

Picture

Display picture displayed on button when button is enabled and not pressed.

PicturePosition

Display picture relative to its caption.

PictureSelectionDisplay

Display picture in the text box of a combo box.

If you do not want a caption displayed with the picture, set the Caption Property to an empty string by deleting the default caption in the property settings box of the Properties Window (Visual FoxPro).

Using Picture Masks

Often, a .bmp picture contains white space you do not want to appear on your controls. A white border around an irregularly shaped image could make your control look bad. To avoid this problem, Visual FoxPro creates a temporary default mask for your picture. White areas are given a transparent attribute so that the underlying color of the button or background shows through. To keep certain white areas of your .bmp white, create a mask for it that will override the default.

To create a mask for a .bmp

  1. Open the .bmp file in Paint or another bitmap utility.

  2. Blacken all areas of the picture that you want to be displayed exactly as they are in the .bmp file. Leave the areas you want to be transparent as white.

  3. Save the file in the same directory and with the same name as the .bmp file but with an .msk extension.

When Visual FoxPro loads a .bmp file specified by the Picture property for a command button, option button, or check box, it looks in the same directory for a matching .msk file. If an .msk file with the same name as the .bmp is in the directory, Visual FoxPro uses it as a mask for the picture. All white areas in the .msk picture are made transparent in the .bmp. All black areas in the .msk picture are displayed exactly as they are in the .bmp.

Note

The .bmp picture and the .msk picture must have the same dimensions for the mask to be able to represent the area of the .bmp.

See Also

Tasks

How to: Manually Adjust Grid Display at Design Time

Concepts

Controls and Objects Created in Earlier Versions

Reference

Controls for Displaying Information

Controls for Manipulating Rows of Data

Other Resources

Using Controls