Udostępnij za pośrednictwem


Visual Basic: Windows Controls

DisabledImageList Property

See Also    Example    Applies To

Returns or sets the ImageList control to be used for disabled images.

Syntax

object.DisabledImageList [= imageList]

Part Description
object An object expression that evaluates to an object in the Applies To list.
imageList An object reference that specifies which ImageList control to use for disabled images.

Remarks

The Button object can display only one image for each button. At run time, it first determines how the button should be drawn (i.e., normal, 'hot' or disabled) and then uses the image from the appropriate image list (ImageList, DisabledImageList or HotImageList) using the sole Image property as the key.  It is important to understand that related images in each of the three image lists must be consistently named so that the Toolbar control pulls the correct ones. For example, if a particular button is making use of all three image types, then each of the three images must be defined in their respective image lists to have either the same Index as the other two or the same Key.

Setting the Toolbar control's Enabled property to False will not cause the images contained by the DisabledImageList to display. Instead, set the Button object's Enabled property is set to False to display an image from the DisabledImageList. To disable all buttons, use the code shown below:

Private Sub DisableAllButtons
   Dim b As Button
   For Each b In Toolbar1.Buttons
      b.Enabled = False
   Next
End Sub

Note The images in the ImageList control assigned to the DisabledImageList property must be the same size as the images in the ImageList control assigned to the ImageList property.