Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftPictureObject.SetColorSample Method

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 SftBox/OCX with ...".

FrameColor

Defines the border color. For information about color properties, please visit the applicable section "Using SftBox/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

    oneCell = box.get_Cell(addColor, 0)     ' get the first cell
    oneCell.Image.Height = 13

    If box Is SftBox2 Then
        oneCell.Image.Width = 26
    Else
        oneCell.Image.Width = 13
    End If
    oneCell.Image.SetColorSample(OLECvt.ToOleColor(color), OLECvt.ToOleColor(color.Black)) ' set the cell's color sample
    ' We'll save the color value in the cell's Data property so
    ' we can use the Items.FindCellData method if needed
    oneCell.Data = ColorTranslator.ToWin32(color)
End Sub

Private Sub AddColors(ByVal box As AxSftBoxLib50.AxSftBox)
    AddColor(box, "Black", Color.Black)

VB6

    Set OneCell = Box.Cell(AddColor, 0) ' get the first cell

    OneCell.Image.Height = 13
    If Box Is SftBox2 Then
        OneCell.Image.Width = 26
    Else
        OneCell.Image.Width = 13
    End If
    OneCell.Image.SetColorSample color, vbBlack ' set the cell's color sample

    ' We'll save the color value in the cell's Data property so
    ' we can use the Items.FindCellData method if needed
    OneCell.Data = color

End Function

C#

    int addColor = box.Items.Add(Text);     // add a new item
    oneCell = box.get_Cell(addColor, 0);    // get the first cell
    oneCell.Image.Height = 13;
    oneCell.Image.Width = 13;
    if (box == SftBox2)
        oneCell.Image.Width = 26;
    else
        oneCell.Image.Width = 13;
    oneCell.Image.SetColorSample(OLECvt.ToOleColor(color), OLECvt.ToOleColor(Color.Black)); // set the cell's color sample
    // We'll save the color value in the cell's Data property so
    // we can use the Items.FindCellData method if needed
    oneCell.Data = ColorTranslator.ToWin32(color);
}

private void AddColors(AxSftBoxLib50.AxSftBox box)
{

C++

    if (fSmallSample) {
        OneCell->Image->Height = 13;
        OneCell->Image->Width = 26;
    } else {
        OneCell->Image->Height = 13;
        OneCell->Image->Width = 13;
    }
    OneCell->Image->SetColorSample(color, RGB(0,0,0)); // set the cell's color sample
    // We'll save the color value in the cell's Data property so
    // we can use the Items.FindCellData method if needed
    OneCell->Data = color;
}

void CColorsDlg::AddColors(ISftBoxPtr vCombo, BOOL fSmallSample)
{
    AddColor(vCombo, fSmallSample, "Black", RGB(0,0,0));

See Also SftPictureObject Object | Object Hierarchy


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