The Image Control

The Image control is used to display image files (most commonly bitmaps, jpegs, or gifs). The Image control can be added to a worksheet from the control toolbox like any other ActiveX control. Figure 3.10 shows the icon for the Image control.

The Check Box control

The Image control

The control toolbox.

The Check Box control

The Image control

The control toolbox.

Image files can be loaded into the Image control at Design Time or run time via the Picture property. Some of the more important properties of the Image control are summarized in Table 3.5

Table 3.5 Selected Properties of the Image Control r

Property

Name

AutoSize BackStyle

Picture

PictureAlignment PictureSizeMode

Function

Used for referencing the control in your program

If true, the control will automatically resize itself to fit the image size.

Use the transparent setting if you don't want the user to know it's there until an image is loaded.

The path to the image file to be displayed

Aligns the image to the specified location

Clip, Stretch, or Zoom. Not important if AutoSize is true. May distort the image.

Table 3.6 lists the properties of the Image controls I changed at Design Time for the Poker Dice program. With the BackStyle property set to transparent, the control cannot be seen unless an image is loaded or the control is selected while in design mode (see Figure 3.9). I matched the size of the Image controls (Width and Height properties) to that of the dice images.

Table 3.6 lists the properties of the Image controls I changed at Design Time for the Poker Dice program. With the BackStyle property set to transparent, the control cannot be seen unless an image is loaded or the control is selected while in design mode (see Figure 3.9). I matched the size of the Image controls (Width and Height properties) to that of the dice images.

r

Table 3.6

Property Settings

OF IMAGE

B

L

Controls

in the Poker Dice

Program

i

L.

r

\

Property

Value

Width, Height

75

Name

imgDice1, imgDice2, etc.

BackStyle

transparent

AutoSize

True

BorderStyle

None

SpecialEffect

Flat

J

The Image control also has several event procedures; most notably the Click(), BeforeDragOver(), and BeforeDropOrPaste() event procedures. I will use the Click() event procedure of the Image controls to allow a user to select a dice; that is, when the user clicks on an image of a dice, its corresponding Check Box will toggle on or off.

Biorhythm Awareness

Biorhythm Awareness

Who else wants to take advantage of biorhythm awareness to avoid premature death, escape life threatening diseases, eliminate most of your life altering mistakes and banish catastrophic events from your life.

Get My Free Ebook


Responses

  • anniina
    How to check the picture property of image control in vb?
    7 years ago

Post a comment