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
Defines the item's level number.
Get
VB.NET | Lvl = object.Level As Short |
VB | Lvl = object.Level As Integer |
C#.NET | short Lvl = object.Level; |
VC++ | short Lvl = object->Level; short Lvl = object->GetLevel(); |
C | HRESULT object->get_Level(short* Lvl); |
Put
VB.NET | object.Level = Lvl As Short |
VB | object.Level = Lvl As Integer |
C#.NET | short object.Level = Lvl; |
VC++ | short object->Level = Lvl; void object->PutLevel(short Lvl); |
C | HRESULT object->put_Level(short Lvl); |
object
A SftTreeItem object.
Lvl
Defines the item's level number. The valid range is 0 through 63.
The Level property defines the item's level number.
The Level property determines the "indentation" of an item. By changing an item's level number, its parent relation is automatically adjusted by the tree control. Using this method, the application does not have to manipulate any parent/child relationships, but can instead treat the entire list of items in a tree control as a linear list, an array of items.
The root (or highest) level is level 0, dependents are on levels 1, 2, 3 and lower. The valid range of levels is 0 through 63.
When changing an item's level using the Level property, its (current and new) parent items will automatically be expanded to make the item visible.
The indentation of item levels can be defined using the Items.Indentation property.
While logically the first item in the tree control should be at level 0, this is not necessary. Also, a parent item does not necessarily require an immediate dependent (on the next lower level); its first dependent could be on a much lower level. While this is very application specific, SftTree/OCX does allow you to build hierarchies of items where parent/child relationships don't have to follow strict rules.
End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AxSftTree1.BulkUpdate = True ' Add all screen fonts to the tree control Dim ScreenIndex As Integer ScreenIndex = AxSftTree1.Items.Add("Fonts") AxSftTree1.get_Item(ScreenIndex).Level = 0 ' display fonts Dim Counter As Integer = 0 Dim ff As FontFamily For Each ff In System.Drawing.FontFamily.Families ' add font name Dim newFont As Font
Dim C As SftTreeCell With SftTree1 ' Mass-Update .BulkUpdate = True ' Add all screen fonts to the tree control ScreenIndex = .Items.Add("Screen Fonts") .Item(ScreenIndex).Level = 0 ' display screen fonts MaxFonts = Screen.FontCount ' limit to 20 fonts If MaxFonts > 20 Then MaxFonts = 20 For I = 0 To MaxFonts - 1 ' add the item ItemIndex = .Items.Add(Screen.Fonts(I))
} } private void Form1_Load(object sender, System.EventArgs e) { axSftTree1.BulkUpdate = true; // Add all screen fonts to the tree control int ScreenIndex = axSftTree1.Items.Add("Fonts"); axSftTree1.get_Item(ScreenIndex).Level = 0; // display fonts int counter = 0; foreach (FontFamily ff in System.Drawing.FontFamily.Families) { // add font name Font newFont = null; try {
fd.lpstrName = FontName; fd.cySize.int64 = 10 * 10000L; // 10pt font fd.sWeight = FW_NORMAL; IFontDispPtr pFontDisp; HRESULT hr = OleCreateFontIndirect(&fd, IID_IFontDisp, (void**)&pFontDisp); if (FAILED(hr)) return; long ItemIndex = m_vTree->Items->Add(FontName); m_vTree->Item[ItemIndex]->Level = 1; m_vTree->Cell[ItemIndex][1]->Text = FontName; m_vTree->Cell[ItemIndex][0]->PutRefFont(pFontDisp); } /*static*/ int CALLBACK CListFontDlg::FontEnumeratorProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, DWORD FontType, LPARAM lParam) {
See Also SftTreeItem Object | Object Hierarchy