该实例表明了如何使用 Add 方法添加一个 ComboItem ,以及如何利用返回的引用更改新对象的属性。
object.Add(Index As Variant, Key As Variant, Text As Variant, Image As Variant,SelImage OverLayImage As Variant, Indentation As Variant) As ComboItem
Dim ci As ComboItemSet
ci = ImageCombo1.ComboItems. _
Add(1, "Signal1", "Signal", "RedLight", "GreenLight", 0, 0)
ci.ToolTipText = "Traffic Light"
ci.Indentation = 2
如果要设置具体某个列表项的缩进值,则需要设置该 ComboItem 对象的 Indentation,同时还需要指定 Key 或 Index 值来确定该对象。例如,下面的代码在列表中每三个项目缩进20个像素:
For Each ComboItem In ImageCombo1.ComboItems
If (ComboItem.Index / 3) = _
(Int(ComboItem.Index / 3)) Then
ComboItem.Indentation = 2
End If
Next ComboItem
如果要设置具体某个列表项的缩进值,则需要设置该 ComboItem 对象的 Indentation,同时还需要指定 Key 或 Index 值来确定该对象。例如,下面的代码在列表中每三个项目缩进20个像素:
For Each ComboItem In ImageCombo1.ComboItems
If (ComboItem.Index / 3) = _
(Int(ComboItem.Index / 3)) Then
ComboItem.Indentation = 2
End If
Next ComboItem
如果要设置具体某个列表项的缩进值,则需要设置该 ComboItem 对象的 Indentation,同时还需要指定 Key 或 Index 值来确定该对象。例如,下面的代码在列表中每三个项目缩进20个像素:
For Each ComboItem In ImageCombo1.ComboItems
If (ComboItem.Index / 3) = _
(Int(ComboItem.Index / 3)) Then
ComboItem.Indentation = 2
End If
Next ComboItem