Share via


Enhancing 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 Picture displayed on the button when the button is disabled.
DownPicture Picture displayed on the button when the button is pressed.
Picture Picture displayed on the button when the button is enabled and not pressed.

If you don't specify a DisabledPicture value, Visual FoxPro displays the Picture grayed when the control is disabled. If you don't specify a DownPicture value, Visual FoxPro displays the Picture with the background colors changed so that the button appears pressed when the button is pressed.

If you don't want a caption displayed in addition to the picture, set the Caption property to an empty string by deleting the default caption in the Property Editing box of the Properties window.

Using Picture Masks

Often, a .bmp picture contains white space you don't 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

Displaying Information | Manipulating Multiple Rows of Data | Using Controls | Manually Adjusting Grid Display at Design Time | Controls and Objects