Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxRowHeaders.MakeOptimal Method

Sets the row header area's optimal width.

Syntax

VB.NETobject.MakeOptimal(ByVal MaxScan As Integer)
VBobject.MakeOptimal(ByVal MaxScan As Long)
C#.NETvoid object.MakeOptimal(int MaxScan);
VC++HRESULT object->MakeOptimal(long MaxScan);
CHRESULT object->raw_MakeOptimal(long MaxScan);

object

A SftBoxRowHeaders object.

MaxScan

The maximum number of items analyzed to determine the optimal row header width. If 0 is specified, all items will be considered.

Comments

The MakeOptimal method sets the row header area's optimal width.

This method resizes the row header so that the row header text and graphics can be completely displayed without being truncated or clipped. The RowHeaders.CalcOptimalWidth method can be used calculate the optimal width without resizing the row header area. The row header width can be changed using the RowHeaders.Width property.

By changing control properties, the optimal row header width may change. Adding items, setting new row header attributes can affect the optimal row header width. The row header may have to be set again to allow row headers to be completely visible. The control does not automatically adjust the row header width.

Calculating the optimal row header width can be a time consuming operation, particularly if many items have been added to the control. MakeOptimal scans all items to determine the best row header width, but can be limited to a specific number of items using the MaxScan argument. This reduces the time spent to calculate the optimal width, but may still leave some items clipped.

Examples

VB.NET

    AxSftBox1.get_Item(ItemIndex).Level = 1

    AddBuiltinImage("Enabled Ascending Indicator", SftPictureImageConstants.sftImageSortAsc, 8, 8)
    AddBuiltinImage("Disabled Ascending Indicator", SftPictureImageConstants.sftImageSortAscDisabled, 8, 8)
    AddBuiltinImage("Enabled Descending Indicator", SftPictureImageConstants.sftImageSortDesc, 8, 8)
    AddBuiltinImage("Disabled Descending Indicator", SftPictureImageConstants.sftImageSortDescDisabled, 8, 8)


    AxSftBox1.RowHeaders.MakeOptimal(0) ' make the row headers optimal
    AxSftBox1.get_Column(0).MakeOptimal(0) ' make the first column optimal
    AxSftBox1.Items.RecalcHorizontalExtent(0) ' update horizontal scroll bar

    AxSftBox1.Items.Selection = 0

    CopyImageFromCurrentItem()
End Sub

VB6

        .Item(ItemIndex).Level = 1

        AddBuiltinImage "Enabled Ascending Indicator", sftImageSortAsc, 8, 8
        AddBuiltinImage "Disabled Ascending Indicator", sftImageSortAscDisabled, 8, 8
        AddBuiltinImage "Enabled Descending Indicator", sftImageSortDesc, 8, 8
        AddBuiltinImage "Disabled Descending Indicator", sftImageSortDescDisabled, 8, 8


        .RowHeaders.MakeOptimal 0 ' make the row headers optimal
        .Column(0).MakeOptimal 0 ' make the first column optimal
        .Items.RecalcHorizontalExtent 0 ' update horizontal scroll bar

        .Items.Selection = 0

        CopyImageFromCurrentItem

C#

    axSftBox1.get_Item(ItemIndex).Level = 1;

    AddBuiltinImage("Enabled Ascending Indicator", SftPictureImageConstants.sftImageSortAsc, 8, 8);
    AddBuiltinImage("Disabled Ascending Indicator", SftPictureImageConstants.sftImageSortAscDisabled, 8, 8);
    AddBuiltinImage("Enabled Descending Indicator", SftPictureImageConstants.sftImageSortDesc, 8, 8);
    AddBuiltinImage("Disabled Descending Indicator", SftPictureImageConstants.sftImageSortDescDisabled, 8, 8);


    axSftBox1.RowHeaders.MakeOptimal(0); // make the row headers optimal
    axSftBox1.get_Column(0).MakeOptimal(0); // make the first column optimal
    axSftBox1.Items.RecalcHorizontalExtent(0); // update horizontal scroll bar

    axSftBox1.Items.Selection = 0;

    CopyImageFromCurrentItem();
}

C++

    m_vBox->Item[ItemIndex]->Level = 1;

    AddBuiltinImage(_T("Enabled Ascending Indicator"), sftImageSortAsc, 8, 8);
    AddBuiltinImage(_T("Disabled Ascending Indicator"), sftImageSortAscDisabled, 8, 8);
    AddBuiltinImage(_T("Enabled Descending Indicator"), sftImageSortDesc, 8, 8);
    AddBuiltinImage(_T("Disabled Descending Indicator"), sftImageSortDescDisabled, 8, 8);


    m_vBox->RowHeaders->MakeOptimal(0); // make the row headers optimal
    m_vBox->Column[0]->MakeOptimal(0); // make the first column optimal
    m_vBox->Items->RecalcHorizontalExtent(0); // update horizontal scroll bar

    m_vBox->Items->Selection = 0;

    CopyImageFromCurrentItem();

See Also SftBoxRowHeaders Object | Object Hierarchy


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