Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

ForeColor Property, SftTreeCell Object

Defines the cell's foreground color.

Syntax

Get

VB.NETClr = object.ForeColor As UInteger
VBClr = object.ForeColor As OLE_COLOR
C#.NETuint Clr = object.ForeColor;
VC++OLE_COLOR Clr = object->ForeColor;
OLE_COLOR Clr = object->GetForeColor();
CHRESULT object->get_ForeColor(OLE_COLOR* Clr);

Put

VB.NETobject.ForeColor = Clr As UInteger
VBobject.ForeColor = Clr As OLE_COLOR
C#.NETuint object.ForeColor = Clr;
VC++OLE_COLOR object->ForeColor = Clr;
void object->PutForeColor(OLE_COLOR Clr);
CHRESULT object->put_ForeColor(OLE_COLOR Clr);

object

A SftTreeCell object.

Clr

Defines the cell's foreground color. -1 indicates that there is no defined color and the default color defined using Column.ForeColor is used. For information about color properties, please visit the applicable section "Using SftTree/OCX with ...".

Comments

The ForeColor property defines the cell's foreground color.

The cell has the foreground color attribute Clr. This color is used as text color when the item is not selected. If the item is selected and uses a suitable selection style (Items.SelectStyle), the Cell.SelectForeColor property is used instead.

Examples

VB.NET

        e.itemObject.Item.Cell(4).Text = "Last " & e.rowIndex
        e.itemObject.Item.RowHeader.Text = "R" & e.rowIndex
        e.itemObject.Item.Enabled = ((e.rowIndex Mod 2) = 0)

        If e.rowIndex Mod 17 = 0 Then
            e.itemObject.Item.RowHeader.Image.NETImageObject = imageListBitmaps.Images(e.rowIndex Mod 10)
        End If
        If e.rowIndex Mod 3 = 0 Then
            e.itemObject.Item.Cell(1).ForeColor = OLECvt.ToOleColor(System.Drawing.Color.Red)
            e.itemObject.Item.Cell(1).BackColor = OLECvt.ToOleColor(System.Drawing.Color.Aqua)
        End If
        If e.rowIndex Mod 5 = 0 Then
            e.itemObject.Item.Cell(1).Font.Bold = True
        End If
        If e.rowIndex Mod 7 = 0 Then
            e.itemObject.Item.Image.NETImageObject = imageListBitmaps.Images((e.rowIndex + 9) Mod 10)

VB6

    ItemObject.Item.Cell(4).Text = "Last " & RowIndex
    ItemObject.Item.RowHeader.Text = "R" & RowIndex
    ItemObject.Item.Enabled = ((RowIndex Mod 2) = 0)

    If RowIndex Mod 17 = 0 Then
        ItemObject.Item.RowHeader.Image.Picture = Image1(RowIndex Mod 10).Picture
    End If
    If RowIndex Mod 3 = 0 Then
        ItemObject.Item.Cell(1).ForeColor = vbRed
        ItemObject.Item.Cell(1).BackColor = vbWhite
    End If
    If RowIndex Mod 5 = 0 Then
        ItemObject.Item.Cell(1).Font.Bold = True
    End If
    If RowIndex Mod 7 = 0 Then
        Set ItemObject.Item.Image.Picture = Image1((RowIndex + 9) Mod 10).Picture

C#

            e.itemObject.Item.get_Cell(3).Text = (e.rowIndex % 7).ToString();
            e.itemObject.Item.get_Cell(4).Text = "Last " + e.rowIndex.ToString();
            e.itemObject.Item.RowHeader.Text = "R" + e.rowIndex.ToString();
            e.itemObject.Item.Enabled = ((e.rowIndex % 2) == 0);

            if (e.rowIndex % 17 == 0)
                e.itemObject.Item.RowHeader.Image.NETImageObject = imageListBitmaps.Images[e.rowIndex % 10];
            if (e.rowIndex % 3 == 0) {
                e.itemObject.Item.get_Cell(1).ForeColor = OLECvt.ToOleColor(System.Drawing.Color.Red);
                e.itemObject.Item.get_Cell(1).BackColor = OLECvt.ToOleColor(System.Drawing.Color.Aqua);
            }
            if (e.rowIndex % 5 == 0)
                e.itemObject.Item.get_Cell(1).Font.Bold = true;
            if (e.rowIndex % 7 == 0) {
                e.itemObject.Item.Image.NETImageObject = imageListBitmaps.Images[(e.rowIndex + 9) % 10];
                e.itemObject.Item.LabelImage.NETImageObject = imageListBitmaps.Images[(e.rowIndex + 1) % 10];

C++

    str.Format(_T("R%ld"), RowIndex);
    pItemObj->Item->RowHeader->Text = (LPCTSTR) str;

    pItemObj->Item->Enabled = ((RowIndex % 2) == 0) ? VARIANT_TRUE : VARIANT_FALSE;

    if (RowIndex % 17 == 0)
        pItemObj->Item->RowHeader->Image->SetImageListH((OLE_HANDLE)(HIMAGELIST)m_Bitmaps, (short)(RowIndex % 10));
    if (RowIndex % 3 == 0) {
        pItemObj->Item->Cell[1]->ForeColor = RGB(255,0,0);
        pItemObj->Item->Cell[1]->BackColor = RGB(255,255,255);
    }
    if (RowIndex % 5 == 0) {
        IFontPtr pFont = pItemObj->Item->Cell[1]->Font();
        pFont->put_Bold(TRUE);
    }
    if (RowIndex % 7 == 0) {

See Also SftTreeCell Object | Object Hierarchy


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