Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxColumn.Width Property

Defines the width of this column.

Syntax

Get

VB.NETW = object.Width As Single
VBW = object.Width As Single
C#.NETfloat W = object.Width;
VC++float W = object->Width;
float W = object->GetWidth();
CHRESULT object->get_Width(float* W);

Put

VB.NETobject.Width = W As Single
VBobject.Width = W As Single
C#.NETfloat object.Width = W;
VC++float object->Width = W;
void object->PutWidth(float W);
CHRESULT object->put_Width(float W);

object

A SftBoxColumn object.

W

Defines the width of this column.

Comments

The Width property defines the width of this column.

The Width and Column.WidthPix properties are synonyms, but may use different coordinate systems.

The Width property is used to change the width of the column described by object. The column width must be greater or equal to the column's minimum width. The minimum width can be defined using the Column.MinWidth property.

The last column in a control may be defined as an open-ended column (see Columns.OpenEnded). An open-ended column cannot be resized, because an open-ended column doesn't have a defined width. An open-ended column will always use the space remaining between the previous column and the right edge of the control window.

Due to the variable number of levels and the resulting hierarchical display, the width of the first column is always treated as a minimum width. The text portion of the first column will always be at least of the specified width, no matter what level the item is on. This can result in the first column being much wider than the defined width. To calculate the actual width of column 0, add the value returned by the Columns.OverheadWidth property to the value returned by Column.Width.

When changing column widths, the Items.RecalcHorizontalExtent method may have to be used to recalculate the optimal horizontal scrolling extent.

The Column.CalcOptimalWidth or Column.MakeOptimal methods can be used to calculate or define the optimal width for a column. An optimal width allows all text and graphic components in a column to be displayed in their entirety, without being clipped.

Examples

VB.NET

        ElseIf index = 7 Then
            AddOneItem("Item " & index, "Cell " & index & ",1", "This cell text is also very long")
        Else
            AddOneItem("Item " & index, "Cell " & index & ",1", "Cell " & index & ",2")
        End If
    Next
    SftBox1.BulkUpdate = False

    SftBox1.get_Column(0).Width = SftBox1.Width / 4
    SftBox1.get_Column(1).Width = SftBox1.Width / 4
    SftBox1.RowHeaders.MakeOptimal(0)
    SftBox1.get_Column(2).MakeOptimal(0)
    SftBox1.Items.RecalcHorizontalExtent(0)
End Sub

Private Function AddOneItem(ByVal Cell0 As String, ByVal Cell1 As String, ByVal Cell2 As String) As Integer

VB6

                AddOneItem "Item " & Index, "Cell " & Index & ",1", "This cell text is also very long"
            Else
                AddOneItem "Item " & Index, "Cell " & Index & ",1", "Cell " & Index & ",2"
            End If
        Next
    End With
    SftBox1.BulkUpdate = False

    SftBox1.Column(0).Width = SftBox1.Width / 4
    SftBox1.Column(1).Width = SftBox1.Width / 4
    SftBox1.RowHeaders.MakeOptimal 0
    SftBox1.Column(2).MakeOptimal 0
    SftBox1.Items.RecalcHorizontalExtent 0
End Sub

C#

            AddOneItem("Item " + index, "This cell text is very long", "Cell " + index + ",2");
        else if (index == 7)
            AddOneItem("Item " + index, "Cell " + index + ",1", "This cell text is also very long");
        else
            AddOneItem("Item " + index, "Cell " + index + ",1", "Cell " + index + ",2");
    }
    SftBox1.BulkUpdate = false;

    SftBox1.get_Column(0).Width = SftBox1.Width / 4;
    SftBox1.get_Column(1).Width = SftBox1.Width / 4;
    SftBox1.RowHeaders.MakeOptimal(0);
    SftBox1.get_Column(2).MakeOptimal(0);
    SftBox1.Items.RecalcHorizontalExtent(0);
}

int AddOneItem(string Cell0, string Cell1, string Cell2)

See Also SftBoxColumn Object | Object Hierarchy


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