SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Adds a new item.
VB.NET | ItemIndex = object.Add(ByVal Text As String) As Integer |
VB | ItemIndex = object.Add(ByVal Text As String) As Long |
C#.NET | int ItemIndex = object.Add(string Text); |
VC++ | long ItemIndex = object->Add(_bstr_t Text); |
C | HRESULT object->raw_Add(BSTR Text, long* ItemIndex); |
object
Text
The text to be added as cell text of the first (or only) column of the item.
ItemIndex
Returns the zero-based index of the item added.
The Add method adds a new item.
New items added using the Add method are always added at the end of the list. By default, new items are added at level 0. Use the Item.Level property to change an item's level.
If many items have to be added, the BulkUpdate property can be used to indicate a mass-update, which is significantly faster.
Once an item has been added, the Cell.Text property can be used to change the text for any of the available cells.
Items can be inserted at a specific location using the Items.Insert method. Items can be deleted using the Items.Remove or Items.Clear methods.
When a control is populated using Items.Add or Items.Insert, the Items.RecalcHorizontalExtent method can be used to have the control calculate the optimal horizontal scrolling area so scroll bars are enabled, depending on the Scrollbars property.
The drop down portion is automatically hidden when the combo box contents are changed using this method. The DropDown.SuppressOn method can be used to suppress hiding the drop down portion when adding/inserting items.
C.Image.Width = 12 C.Image.Height = 12 C.ImageHAlign = Align PropagateImage(ItemIndex, C.Image) End Sub Private Sub AddColor(ByVal Text As String, ByVal Clr As Color) Dim i As Integer i = AxSftBox1.Items.Add(Text) AxSftBox1.get_Item(i).Level = 2 UpdateColor(i, Clr, SftBoxHAlignConstants.halignSftBoxRight) End Sub Private Sub UpdateBuiltinImage(ByVal ItemIndex As Integer, ByVal Style As SftPictureImageConstants, ByVal wPix As Integer, ByVal hPix As Integer, ByVal Align As SftBoxHAlignConstants) Dim C As SftBoxCell C = AxSftBox1.get_Cell(ItemIndex, 0)
C.Image.Width = 12 C.Image.Height = 12 C.ImageHAlign = Align PropagateImage ItemIndex, C.Image End Sub Private Sub AddColor(ByVal Text As String, ByVal Clr As OLE_COLOR) Dim I As Integer I = SftBox1.Items.Add(Text) SftBox1.Item(I).Level = 2 UpdateColor I, Clr, halignSftBoxRight End Sub Private Sub UpdateBuiltinImage(ByVal ItemIndex As Integer, ByVal Style As SftPictureImageConstants, ByVal wPix As Integer, ByVal hPix As Integer, ByVal Align As SftBoxHAlignConstants) Dim C As SftBoxCell Set C = SftBox1.Cell(ItemIndex, 0)
C.Image.Height = 12; C.ImageHAlign = Align; PropagateImage(ItemIndex, C.Image); } private void AddColor(string Text, Color Clr) { int i; i = axSftBox1.Items.Add(Text); axSftBox1.get_Item(i).Level = 2; UpdateColor(i, Clr, SftBoxHAlignConstants.halignSftBoxRight); } private void UpdateBuiltinImage(int ItemIndex, SftPictureImageConstants Style, int wPix, int hPix, SftBoxHAlignConstants Align) { SftBoxCell C = axSftBox1.get_Cell(ItemIndex, 0);
// Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon m_vBox = m_Box.GetControlUnknown(); ASSERT(m_vBox != NULL); long ItemIndex = m_vBox->Items->Add("Supported Picture Types"); m_vBox->Cell[ItemIndex][1]->Text = _T("SftBox/OCX supports numerous image types, such as GDI+ images, bitmaps, icons, ImageLists and also offers numerous built-in images."); // add GDI+ samples ItemIndex = m_vBox->Items->Add(_T("GDI+ Images")); m_vBox->Item[ItemIndex]->Level = 1;
See Also SftBoxItems Object | Object Hierarchy