Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

BackColor Property, SftTreeCell Object

Defines the cell's background color.

Syntax

Get

VB.NETClr = object.BackColor As UInteger
VBClr = object.BackColor As OLE_COLOR
C#.NETuint Clr = object.BackColor;
VC++OLE_COLOR Clr = object->BackColor;
OLE_COLOR Clr = object->GetBackColor();
CHRESULT object->get_BackColor(OLE_COLOR* Clr);

Put

VB.NETobject.BackColor = Clr As UInteger
VBobject.BackColor = Clr As OLE_COLOR
C#.NETuint object.BackColor = Clr;
VC++OLE_COLOR object->BackColor = Clr;
void object->PutBackColor(OLE_COLOR Clr);
CHRESULT object->put_BackColor(OLE_COLOR Clr);

object

A SftTreeCell object.

Clr

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

Comments

The BackColor property defines the cell's background color.

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

The Cell.BackColorEnd property can be used to define the cell's background color, combined with BackColor creating a gradient fill. The orientation of the gradient fill can be defined using the Cell.BackColorOrientation property.

Examples

VB.NET

        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)
            e.itemObject.Item.LabelImage.NETImageObject = imageListBitmaps.Images((e.rowIndex + 1) Mod 10)

VB6

    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
        Set ItemObject.Item.LabelImage.Picture = Image1((RowIndex + 1) Mod 10).Picture

C#

            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++

    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) {
        pItemObj->Item->Image->SetImageListH((OLE_HANDLE)(HIMAGELIST)m_Bitmaps, (short)((RowIndex + 9) % 10));

See Also SftTreeCell Object | Object Hierarchy


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


Spring Break!

Our offices will be closed this week (March 18 through March 22).

We'll be back March 24 to address any pending sales and support issues.