SftTree/OCX 7.5 - ActiveX Tree Control


Font Property, SftTree Object

Defines the default font used to display cell text.



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


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


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


A SftTree object.


Defines the default font used to display cell text. For information about font properties, please visit the applicable section "Using SftTree/OCX with ...".


The Font property defines the default font used to display cell text.

The Font property defines the default font used for all cells. The height for items is calculated based on the Font and Items.Lines properties so that cell text is never clipped vertically, unless multi-line text is used with more lines than defined using the Items.Lines property.

The Cell.Font property can be used to override an individual cell's font. The Footers.Font, Headers.Font and RowHeaders.Font properties are used to define the fonts used to display the column footers, column headers and row headers.



        AxSftTree1.Headers.SortIndicators = SftTreeHeaderSortIndicatorsConstants.headerSortIndicatorsSftTreeAuto
        AxSftTree1.get_Header(0).SortIndicator = SftTreeSortIndicatorConstants.sortIndicatorSftTreeAscending

        Dim R As Random
        R = New Random()

        ' set the cell font for books
        Dim fnt As Font
        fnt = New Font(AxSftTree1.Font, FontStyle.Bold)
        Dim pFont As stdole.IFontDisp
        pFont = OLECvt.ToIFontDisp(fnt)

        Dim bk As Integer
        For bk = 1 To 4
            ' add a book
            Dim bookIndex As Integer


            // set the column header sort indicators
            axSftTree1.Headers.SortIndicators = SftTreeHeaderSortIndicatorsConstants.headerSortIndicatorsSftTreeAuto;
            axSftTree1.get_Header(0).SortIndicator = SftTreeSortIndicatorConstants.sortIndicatorSftTreeAscending;

            Random random = new Random();

            // set the cell font for books
            Font fnt = new Font(axSftTree1.Font, FontStyle.Bold);
            stdole.IFontDisp pFont = OLECvt.ToIFontDisp(fnt);

            for (int bk = 1 ; bk <= 4 ; ++bk) {
                // add a book
                int bookIndex = axSftTree1.Items.Add("Book " + bk.ToString());

                axSftTree1.get_Cell(bookIndex, 1).Text = "Description for book " + bk.ToString();
                int size = random.Next(1, bk == 1 ? 99 : 999);



    // set the column header sort indicators
	m_vTree->Headers->SortIndicators = headerSortIndicatorsSftTreeAuto;
    m_vTree->Header[0]->SortIndicator = sortIndicatorSftTreeAscending;

    // make a copy of the tree control's font and make a bold
    // font for certain cells
    IFontPtr pFont = m_vTree->GetFont();
    IFontPtr pCellFont;
    HRESULT hr = pFont->Clone(&pCellFont);

    // Add all available options
    for (int bk = 1 ; bk <= 4 ; ++bk) {

See Also SftTree Object | Object Hierarchy

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