|
|
Title | Use the ImageCombo control |
Keywords | ImageCombo, ImageList, ComboBox |
Categories | Controls |
|
|
At design time, add an ImageList control to the form, right click it, and select Properties. Click the Images tab. Use the Insert button to add images. Give each image Key and Tag values if desired.
At runtime, this program attaches the ImageCombo to the ImageList control. It then creates items in the ImageCombo for each picture in the ImageList. It uses each image's Key value in the ImageList as the ImageCombo's text.
Finally, the program selects the first item.
|
|
Private Sub Form_Load()
Dim i As Integer
' Attach the ImageCombo to the ImageList that
' holds its pictures.
Set ImageCombo1.ImageList = ImageList1
' Create some items.
For i = 1 To ImageList1.ListImages.Count
ImageCombo1.ComboItems.Add , , _
ImageList1.ListImages(i).Key, i
Next i
' Select the first item.
Set ImageCombo1.SelectedItem = ImageCombo1.ComboItems(1)
End Sub
|
|
Note that the ImageCombo resizes its ComboBox size to fit the images in the ImageList.
|
|
|
|
|
|