Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

SetImage Method, SftPictureObject Object

Defines the picture object attributes defined as a GDI+ image.

Syntax

VB.NETobject.SetImage(ByVal GDIPlusImage As Integer, ByVal Owned As Boolean)
VBobject.SetImage(ByVal GDIPlusImage As LONG_PTR, ByVal Owned As Boolean)
C#.NETvoid object.SetImage(int GDIPlusImage, bool Owned);
VC++HRESULT object->SetImage(LONG_PTR GDIPlusImage, VARIANT_BOOL Owned);
CHRESULT object->raw_SetImage(LONG_PTR GDIPlusImage, VARIANT_BOOL Owned);

object

A SftPictureObject object.

GDIPlusImage

A pointer to a Gdiplus::Image object.

Owned

Set to True if the GDI+ image is owned by the tree control, False otherwise.

Comments

The SetImage method defines the picture object attributes defined as a GDI+ image.

The SetImage property offers support for PNG, TIFF, JPEG, GIF, Exif, EMF+, EMF (GDI+ images) with full support for alpha-blended (translucent and semi-transparent) images.

If Owned is set to False, the image remains owned by the application and must remain valid as long as it is used by the tree control. Once it is no longer needed, it must be deleted by the application. Most languages, except C++, automatically delete the object when it is no longer needed so no action is usually necessary.

If Owned is set to True, the tree control automatically deletes the image object when it is no longer needed.

The SftPictureObject.Type property is set to sftTypeGDIPlus. The SftPictureObject.ActualHeight and SftPictureObject.ActualWidth properties reflect the image size.

The Image property can also be used to define the image object using a GDI+ image, but it does not assign ownership of the GDI+ image to the tree control. SetImage(image, False) is identical to the use of the Image property.

Examples

VB6

    Set C.Image.Picture = Pic
    C.ImageHAlign = Align
    PropagateImage ItemIndex, C.Image
End Sub

Private Sub UpdateImages(ByVal ItemIndex As Integer, ByVal Pic As LONG_PTR, ByVal Align As SftTreeHAlignConstants)
    Dim C As SftTreeCell
    Set C = SftTree1.Cell(ItemIndex, 0)
    C.Image.SetImage Pic, True
    C.ImageHAlign = Align
    PropagateImage ItemIndex, C.Image
End Sub

Private Sub UpdateImageList(ByVal ItemIndex As Integer, ByVal ImageListControl As ImageList, ByVal I As Integer, ByVal Align As SftTreeHAlignConstants)
    Dim C As SftTreeCell
    Set C = SftTree1.Cell(ItemIndex, 0)

See Also SftPictureObject Object | Object Hierarchy


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