Gets or sets the ImageList that contains the Image displayed on a button control.
[Visual Basic] Public Property ImageList As ImageList [C#] public ImageList ImageList {get; set;} [C++] public: __property ImageList* get_ImageList(); public: __property void set_ImageList(ImageList*); [JScript] public function get ImageList() : ImageList; public function set ImageList(ImageList);
An ImageList. The default value is a null reference (in Visual Basic Nothing).
When the ImageList or ImageIndex property is set the Image property will be set to its default value, a null reference (Nothing).
If the ImageList property changes and the ImageIndex property becomes greater than the upper bounds of the new ImageList, the ImageIndex property is set to its default value,-1.
The following example uses the derived class, Button and sets the ImageList and ImageIndex properties. This code assumes an ImageList has been instanciated and a minimum of one Image has been assigned to it.
[Visual Basic]
Private Sub MySub() ' Create a new resource. Dim resources As System.Resources.ResourceManager = _ New System.Resources.ResourceManager("Form1", "") ' Assign the ImageList to the button control. Button1.ImageList = ImageList1 ' Select the image from the ImageList (using the ImageIndex property). Button1.ImageIndex = 0 ' Get the image from the resource. Set Button1.Image = resources.GetObject("Button1.Image") End Sub
ButtonBase Class | ButtonBase Members | System.WinForms Namespace | Image | ImageIndex