Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

SetColorSample Method, SftPictureObject Object

Defines the picture object as a color sample.

Syntax

VB.NETobject.SetColorSample(ByVal SampleColor As UInteger, ByVal FrameColor As UInteger)
VBobject.SetColorSample(ByVal SampleColor As OLE_COLOR, ByVal FrameColor As OLE_COLOR)
C#.NETvoid object.SetColorSample(uint SampleColor, uint FrameColor);
VC++HRESULT object->SetColorSample(OLE_COLOR SampleColor, OLE_COLOR FrameColor);
CHRESULT object->raw_SetColorSample(OLE_COLOR SampleColor, OLE_COLOR FrameColor);

object

A SftPictureObject object.

SampleColor

Defines the color sample. For information about color properties, please visit the applicable section "Using SftTree/OCX with ...".

FrameColor

Defines the border color. For information about color properties, please visit the applicable section "Using SftTree/OCX with ...".

Comments

The SetColorSample method defines the picture object as a color sample.

The SftPictureObject.Type property is set to sftTypeColorSample.

The SftPictureObject.Height and SftPictureObject.Width properties should be used to define the requested image size.

The color sample can also be defined using the SftPictureObject.SampleColor and SftPictureObject.FrameColor properties.

Examples

VB.NET

        C.Image.SetImageListH(ImageListControl.Handle.ToInt32(), i)
        C.ImageHAlign = Align
        PropagateImage(ItemIndex, C.Image)
    End Sub

    Private Sub UpdateColor(ByVal ItemIndex As Integer, ByVal Clr As System.Drawing.Color, ByVal Align As SftTreeHAlignConstants)
        Dim C As SftTreeCell
        C = AxSftTree1.get_Cell(ItemIndex, 0)
        C.Image.SetColorSample(Convert.ToUInt32(ColorTranslator.ToOle(Clr) And &HFFFFFFFF&), _
                                Convert.ToUInt32(ColorTranslator.ToOle(Color.Black) And &HFFFFFFFF&))
        C.Image.Width = 12
        C.Image.Height = 12
        C.ImageHAlign = Align
        PropagateImage(ItemIndex, C.Image)
    End Sub

VB6

    C.Image.SetImageList ImageListControl, I
    C.ImageHAlign = Align
    PropagateImage ItemIndex, C.Image
End Sub

Private Sub UpdateColor(ByVal ItemIndex As Integer, ByVal Clr As OLE_COLOR, ByVal Align As SftTreeHAlignConstants)
    Dim C As SftTreeCell
    Set C = SftTree1.Cell(ItemIndex, 0)
    C.Image.SetColorSample Clr, vbBlack
    C.Image.Width = 12
    C.Image.Height = 12
    C.ImageHAlign = Align
    PropagateImage ItemIndex, C.Image
End Sub

Private Sub AddColor(ByVal Text As String, ByVal Clr As OLE_COLOR)

C#

            C.Image.SetImageListH((int) ImageListControl.Handle, (short) i);
            C.ImageHAlign = Align;
            PropagateImage(ItemIndex, C.Image);
        }

        private void UpdateColor(int ItemIndex, System.Drawing.Color Clr, SftTreeHAlignConstants Align)
        {
            SftTreeCell C = axSftTree1.get_Cell(ItemIndex, 0);
            C.Image.SetColorSample((uint) ColorTranslator.ToOle(Clr), (uint) ColorTranslator.ToOle(Color.Black));
            C.Image.Width = 12;
            C.Image.Height = 12;
            C.ImageHAlign = Align;
            PropagateImage(ItemIndex, C.Image);
        }

        private void AddColor(string Text, Color Clr)

C++

    C->Image->SetImageListH((OLE_HANDLE)hImgList, iImage);
    C->ImageHAlign = Align;
    PropagateImage(ItemIndex, C->Image);
}

void CPicturesDlg::UpdateColorSample(long ItemIndex, COLORREF Clr, SftTreeHAlignConstants Align)
{
    ISftTreeCellPtr C = m_vTree->Cell[ItemIndex][0];
    C->Image->SetColorSample(Clr, 0x80000000L|COLOR_WINDOWTEXT);
    C->Image->Width = 12;
    C->Image->Height = 12;
    C->ImageHAlign = Align;
    PropagateImage(ItemIndex, C->Image);
}

void CPicturesDlg::AddBuiltinImage(LPCTSTR lpszName, SftPictureImageConstants Appearance, long Width, long Height)

See Also SftPictureObject Object | Object Hierarchy


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