SftTree/OCX 7.5 - ActiveX Tree Control


Font Property, SftTreeCell Object

Defines the font used for this cell.



VB.NETrefFontObj = object.Font As stdole.IFontDisp
VBSet refFontObj = object.Font As IFontDisp
C#.NETstdole.IFontDisp refFontObj = object.Font;
VC++IFontDisp* refFontObj = object->GetFont();
CHRESULT object->get_Font(IFontDisp** refFontObj);


VB.NETobject.let_Font(ByVal refFontObj As stdole.IFontDisp)
VBobject.Font = refFontObj As IFontDisp
C#.NETvoid object.let_Font(stdole.IFontDisp refFontObj);
VC++void object->PutFont(IFontDisp* refFontObj);
CHRESULT object->put_Font(IFontDisp* refFontObj);


VB.NETobject.Font = refFontObj As stdole.IFontDisp
VBSet object.Font = refFontObj As IFontDisp
C#.NETstdole.IFontDisp object.Font = refFontObj;
VC++void object->PutRefFont(IFontDisp* refFontObj);
CHRESULT object->putref_Font(IFontDisp* refFontObj);


A SftTreeCell object.


Defines the font used for this cell. For information about font properties, please visit the applicable section "Using SftTree/OCX with ...".


The Font property defines the font used for this cell.

The Font property overrides the control's Font property for the specified cell. If the Font property is not set for a particular cell, the control's Font property is used to draw the cell text instead. The cell's Font property can be set to the value Nothing, which restores the tree control's default font, defined using the control's Font property.

When using fixed height items (see Items.Style) and the Font property describes a font that is larger than the control's Font property, cell text will be clipped vertically. Items do not adjust their height to the Font property. Cell text is centered vertically and horizontally based on the Cell.TextVAlign and Cell.TextHAlign properties.



                Counter = Counter + 1
                If Counter > 50 Then ' only add up to 50
                    Exit For
                End If
                Dim ItemIndex As Integer
                ItemIndex = AxSftTree1.Items.Add(ff.Name)
                AxSftTree1.get_Item(ItemIndex).Level = 1
                ' set the font
                AxSftTree1.get_Cell(ItemIndex, 0).Font = OLECvt.ToIFontDisp(newFont)
                ' set the font name in column 1
                AxSftTree1.get_Cell(ItemIndex, 1).Text = ff.Name
            End If

        AxSftTree1.BulkUpdate = False
        ' make column widths optimal


        ' 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))
            .Item(ItemIndex).Level = 1
            ' set the cell name and font in column 0
            Set C = .Cell(ItemIndex, 0)
            C.Font.Name = Screen.Fonts(I)
            ' not bold
            C.Font.Bold = False
            ' 10 pt
            C.Font.Size = 10
            ' set the font name in column 1
            .Cell(ItemIndex, 1).Text = Screen.Fonts(I)
        Next I


                    newFont = null;
                if (newFont != null) {
                    if (++counter > 50)  // only add up to 50
                    int itemIndex = axSftTree1.Items.Add(ff.Name);
                    axSftTree1.get_Item(itemIndex).Level = 1;
                    // set the font
                    axSftTree1.get_Cell(itemIndex, 0).Font = OLECvt.ToIFontDisp(newFont);
                    // set the font name in column 1
                    axSftTree1.get_Cell(itemIndex, 1).Text = ff.Name;

            axSftTree1.BulkUpdate = false;
            // make column widths optimal


    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;


/*static*/ int CALLBACK CListFontDlg::FontEnumeratorProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, DWORD FontType, LPARAM lParam)
    CListFontDlg* PTHIS = (CListFontDlg*) lParam;

See Also SftTreeCell Object | Object Hierarchy

Last Updated 08/13/2020 - (email)
© 2023 Softel vdm, Inc.