![]() | Type | Description | ||
| String | A String expression that specifies the HTML caption being displayed on the control's label. |
The LabelText has effect only if you have:
In other words, the LabelText property allows you to specify a custom text for the control's label no matter of what the user selected in the drop down portion of the control.
For instance, you can allow multiple selection using the LabelText as you can build the list of cells being checked and put them in the LabelText property.
The following screen shot shows the control's label displaying the list of checked items:
The following VB sample changes the LabelText property once a check box state is changed, and allow checking a cell once the user clicks an item:
Private Sub ComboBox1_CellStateChanged(ByVal Cell As EXCOMBOBOXLibCtl.HCELL)
Dim s As String
With ComboBox1
For Each i In .Items
With .Items
If Not (.CellState(i, 0) = 0) Then
s = s + IIf(Len(s) = 0, "", ",") & .CellCaption(i, 0)
End If
End With
Next
.LabelText = " " & s & " "
End With
End Sub
Private Sub ComboBox1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
With ComboBox1
Dim h As Long, c As Long, hit As HitTestInfoEnum
h = .ItemFromPoint(-1, -1, c, hit)
If Not (exHTCellCheck = (hit And exHTCellCheck)) Then
With .Items
.CellState(.FocusItem, 0) = (1 + .CellState(.FocusItem, 0)) Mod 2
End With
End If
End With
End Sub
The following VB/NET sample changes the LabelText property once a check box state is changed, and allow checking a cell once the user clicks an item:
private void excombobox1_CellStateChanged(object sender, int Item, int ColIndex)
{
string s = "";
exontrol.EXCOMBOBOXLib.Items items = excombobox1.Items;
for ( int i = 0; i < items.ItemCount; i++)
{
int h = items.get_ItemByIndex(i);
if ( items.get_CellState(h,0) != 0 )
s = s + (s.Length == 0 ? "": ",") + items.get_CellCaption(h, 0);
}
excombobox1.LabelText = " " + s + " ";
}
private void excombobox1_MouseUpEvent(object sender, short Button, short Shift, int X, int Y)
{
int c = 0;
exontrol.EXCOMBOBOXLib.HitTestInfoEnum hit = exontrol.EXCOMBOBOXLib.HitTestInfoEnum.exHTCell;
int h = excombobox1.get_ItemFromPoint(-1, -1, ref c, ref hit);
if (exontrol.EXCOMBOBOXLib.HitTestInfoEnum.exHTCellCheck != (hit & exontrol.EXCOMBOBOXLib.HitTestInfoEnum.exHTCellCheck))
{
exontrol.EXCOMBOBOXLib.Items items = excombobox1.Items;
items.set_CellState(items.FocusItem, 0, (1 + items.get_CellState(items.FocusItem, 0)) % 2);
}
}
The LabelText property supports the following HTML tags: