Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxCell.Image Property

Defines the graphic displayed in this cell.

Syntax

Get

VB.NETrefImageObj = object.Image As SftPictureObject
VBSet refImageObj = object.Image As SftPictureObject
C#.NETSftPictureObject refImageObj = object.Image;
VC++ISftPictureObject* refImageObj = object->Image;
ISftPictureObject* refImageObj = object->GetImage();
CHRESULT object->get_Image(ISftPictureObject** refImageObj);

Put

VB.NETobject.Image = refImageObj As SftPictureObject
VBobject.Image = refImageObj As SftPictureObject
C#.NETSftPictureObject object.Image = refImageObj;
VC++ISftPictureObject* object->Image = refImageObj;
void object->PutImage(ISftPictureObject* refImageObj);
CHRESULT object->put_Image(ISftPictureObject* refImageObj);

object

A SftBoxCell object.

refImageObj

Defines the graphic displayed in this cell.

Comments

The Image property defines the graphic displayed in this cell.

In a fixed height combo box control, all cell picture graphics must be the same size (height and width). The dimensions of the graphics are used to calculate the minimum required height for all items, so graphics and text are never clipped vertically. To change the size of all cell graphics used, they must be removed first using the Items.ClearCellImages method.

In a variable height combo box control, the graphics can be of varying sizes. The item height is automatically adjusted so graphics are never clipped vertically.

If the image object refImageObj defines a bitmap, the top, left pixel of the bitmap must contain the bitmap's background color. This color will be replaced throughout the bitmap with the actual background (see Bitmap Transparency).

The Items.ClearCellImages method can be used to remove all cell graphics. To remove an individual cell picture, set the property to Nothing (0, null, NULL).

The position of the cell graphics is determined by the Cell.ImageHAlign and Cell.ImageVAlign properties.

Examples

VB.NET

    Dim ItemIndex As Integer
    Dim Img As SftPictureObject

    ItemIndex = AxSftBox1.Items.Selection
    If ItemIndex < 0 Then Exit Sub

    ' don't use images that are too large in the other areas
    Img = AxSftBox1.get_Cell(ItemIndex, 0).Image
    If Img.ActualHeight <= 20 And Img.ActualWidth <= 20 Then
        AxSftBox1.RowColumnHeader.Image = Img
        AxSftBox1.get_Header(1).Image = Img
    Else
        AxSftBox1.RowColumnHeader.Image.Clear()
        AxSftBox1.get_Header(1).Image.Clear()
    End If
End Sub

VB6

Private Sub CopyImageFromCurrentItem()
    Dim ItemIndex As Integer
    Dim Img As SftPictureObject

    ItemIndex = SftBox1.Items.Selection
    If ItemIndex < 0 Then Exit Sub

    ' don't use images that are too large in the other areas
    Set Img = SftBox1.Cell(ItemIndex, 0).Image
    If Img.ActualHeight <= 20 And Img.ActualWidth <= 20 Then
        SftBox1.RowColumnHeader.Image = Img
        SftBox1.Header(1).Image = Img
    Else
        SftBox1.RowColumnHeader.Image.Clear
        SftBox1.Header(1).Image.Clear
    End If

C#

    int ItemIndex;
    SftPictureObject Img;

    ItemIndex = axSftBox1.Items.Selection;
    if (ItemIndex < 0)
        return;

    // don't use images that are too large in the other areas
    Img = axSftBox1.get_Cell(ItemIndex, 0).Image;
    if (Img.ActualHeight <= 20 && Img.ActualWidth <= 20) {
        axSftBox1.RowColumnHeader.Image = Img;
        axSftBox1.get_Header(1).Image = Img;
    } else {
        axSftBox1.RowColumnHeader.Image.Clear();
        axSftBox1.get_Header(1).Image.Clear();
    }

C++

        m_vBox->Item[ItemIndex]->LabelImage = Img;
        m_vBox->Item[ItemIndex]->RowHeader->Image = Img;
    }
}

void CPicturesDlg::UpdateBitmap(long ItemIndex, const CBitmap& bmp, SftBoxHAlignConstants Align)
{
    ISftBoxCellPtr C = m_vBox->Cell[ItemIndex][0];
    C->Image->PutBitmapHandle((OLE_HANDLE)(HBITMAP) bmp);
    C->ImageHAlign = Align;
    PropagateImage(ItemIndex, C->Image);
}

void CPicturesDlg::UpdateImage(long ItemIndex, int resourceID, SftBoxHAlignConstants Align)
{
    ISftBoxCellPtr C = m_vBox->Cell[ItemIndex][0];

See Also SftBoxCell Object | Object Hierarchy


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