Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Image

The Image control is used to place bitmaps on a form. Images, unlike bitmaps in 2.x versions of FoxPro, may also participate in events.

Property

Value

Meaning

BackStyle

0

Transparent: Objects behind the picture should be visible.

1

Opaque, the default: Objects behind the image are obscured.

Stretch

0

Clipped: The image is shown actual size. If the image exceeds the size of the control's width and height, the remainder of the image is cropped.

1

Isometric: The image is stretched or shrunken to fit the area of the Image control, without distorting the image's proportions.

2

Stretch: The image is distorted to fill the entire width and height of the Image control.

Picture

Character

The path and filename of the picture to be displayed. Visual FoxPro 3.x and 5.x display only BMPs and ICOs natively, and an OLE server is needed for other formats. VFP 6 and later versions support GIFs and JPGs as well as BMPs, ICOs, CURs and ANIs.

The Image control contains the usual Top, Left, Height and Width properties, and the usual suspects for methods: MouseUp, MouseDown, Click, DragOver, DragDrop, and so on. Although an image can be used as a pushbutton, or a hot area or “invisible button” in 2.x terminology, we prefer to use command buttons and check boxes for these tasks, due to their richer capabilities: Buttons have DownPicture and DisablePicture properties as well as When, Valid and InteractiveChange events.

While it isn’t documented in some versions, Image controls can display cursors (CUR) and animated cursors (ANI) as well. Images don’t allow their pictures to be edited—use an OLEControl or OLEBoundControl for that.

Example

oForm.AddObject("imgPicture","Image")
oForm.imgPicture.Picture = GETPICT()
oForm.imgPicture.Visible = .T.

See Also

OLEBoundControl, OLEControl