HeaderPane
Main

SftPicture2 Documentation

Share Link
Print

SFT_PICTURE Structure

SFT_PICTURE describes a single image, glyph or picture-bearing slot used by every Softel vdm DLL control. It is a type-tagged union: the type field selects which arm of the embedded Picture union is meaningful. The same structure can hold a bitmap, icon, image-list entry, OLE picture, GDI+ image, .NET image, color sample, dimension placeholder, AVI animation, or one of the built-in glyphs (check box, radio button, up/down, sort indicator).

C

typedef struct tagSftPicture {
    BYTE type;                          // see SFT_PICTURE_xxx
    BYTE align;                         // see SFT_PICALIGN_xxx
    BYTE valign;                        // see SFT_PICALIGN_xxx
    BYTE flag1;                         // see SFT_PICFLAG_xxx
    union tagSftPictureItem {
        HICON hIcon;                                     // SFT_PICTURE_ICON / _16x16 / _32x32
        HBITMAP hBitmap;                                 // SFT_PICTURE_BITMAP
        struct tagSftPicImage {                          // {linksame "SFT_PICTURE_IMAGELIST" def_sft_picture_types}
            HIMAGELIST hImageList;
            short iImage;                                // normal image index
            short iImageDisabled;                        // disabled image index
        } Image;
        struct tagSftPicImageOvl {                       // {linksame "SFT_PICTURE_IMAGELISTOVL" def_sft_picture_types}
            HIMAGELIST hImageList;
            short iImage;
            short iImageOvl;                             // overlay image index
            short ovlStyle;                              // SFT_IMAGEOVL_GHOSTED
        } ImageOvl;
        struct tagSftPicClrSample {                      // {linksame "SFT_PICTURE_COLOR_SAMPLE" def_sft_picture_types}
            int csW, csH;                                // width, height
            COLORREF sampleColor;                        // fill color
            COLORREF frameColor;                         // border color, -1 for none
        } ColorSample;
        struct tagSftPicDimensions {                     // {linksame "SFT_PICTURE_SIZEONLY" def_sft_picture_types}
            int dimW, dimH;                              // width, height
        } Dimension;
        struct tagSftPicCheckBox {                       // {linksame "SFT_PICTURE_CB" def_sft_picture_types} / _CB3 / _RB / _UPDOWN / _UPDOWNSORT
            int cbW, cbH;                                // width, height
            int state:2;                                 // (-1), 0, 1
            int enabled:1;                               // 0, -1
        } CheckBox;
        struct tagSftGDIPlusImage {                      // {linksame "SFT_PICTURE_GDIPLUS" def_sft_picture_types}
            LPVOID lpImageObject;                        // Gdiplus::Image*
        } GDIPlusImage;
        struct tagSftNETImage {                          // {linksame "SFT_PICTURE_NET" def_sft_picture_types}
            IUnknown* pUnknown;                          // .NET System.Drawing.Image (IUnknown)
        } NETImage;
        IPictureDisp* IPicDisp;                          // SFT_PICTURE_IDISPATCH
        IPicture* IPic;                                  // SFT_PICTURE_IPICTURE
        HWND hwndAnim;                                   // SFT_PICTURE_AVI
    } Picture;

} SFT_PICTURE, FAR * LPSFT_PICTURE;

typedef const SFT_PICTURE FAR * LPCSFT_PICTURE;

Header members

type

Type discriminator. Selects which member of the Picture union is meaningful. One of the SFT_PICTURE_* constants, or 0 for an empty slot.

align

Horizontal alignment of the picture within its slot. One of SFT_PICALIGN_CENTER (default), SFT_PICALIGN_LEFT, SFT_PICALIGN_RIGHT or SFT_PICALIGN_FLUSH.

valign

Vertical alignment of the picture within its slot. One of SFT_PICALIGN_VCENTER (default), SFT_PICALIGN_TOP or SFT_PICALIGN_BOTTOM.

flag1

Reserved for the picture-management implementation - see SFT_PICFLAG_FREE. Application code should leave this field at zero.

Picture union members

hIcon

Icon handle. Valid when type is SFT_PICTURE_ICON, SFT_PICTURE_ICON_16x16 or SFT_PICTURE_ICON_32x32.

hBitmap

Bitmap handle. Valid when type is SFT_PICTURE_BITMAP. The top-left pixel is treated as the transparent color.

hImageList, iImage, iImageDisabled

Image list handle and entry indices. Valid when type is SFT_PICTURE_IMAGELIST. iImage is drawn in the enabled state; iImageDisabled is drawn in the disabled state (set to -1 to reuse iImage - the system applies a generic graying effect at draw time).

iImageOvl, style

Overlay image index and overlay style. Valid when type is SFT_PICTURE_IMAGELISTOVL (in addition to hImageList and iImage above). style accepts SFT_IMAGEOVL_GHOSTED.

w, h, sampleColor, frameColor

Color sample fields - width, height, fill color, border color. Valid when type is SFT_PICTURE_COLOR_SAMPLE. Set frameColor to -1 (or SFT_NOCOLOR) to draw no border.

w, h

Layout-placeholder dimensions. Valid when type is SFT_PICTURE_SIZEONLY. The slot reserves space for a w by h rectangle but draws nothing.

w, h, state, enabled

Glyph fields - width, height, state, enabled flag. Valid when type is SFT_PICTURE_CB, SFT_PICTURE_CB3, SFT_PICTURE_RB, SFT_PICTURE_UPDOWN or SFT_PICTURE_UPDOWNSORT. state interpretation depends on the type (CB: 0/1; CB3 and RB: -1/0/1; UPDOWN: 0=down, 1=up; UPDOWNSORT: 0=descending, 1=ascending). enabled grays the glyph when zero (UPDOWNSORT ignores this field).

lpImageObject

Pointer to a Gdiplus::Image object. Valid when type is SFT_PICTURE_GDIPLUS. The application creates and owns the GDI+ Image; the SFT_PICTURE only stores the pointer.

pUnknown

Pointer to an IUnknown for a .NET image (typically obtained via System.Drawing.Image.GetIUnknownForObject). Valid when type is SFT_PICTURE_NET.

IPicDisp

IPictureDisp pointer. Valid when type is SFT_PICTURE_IDISPATCH. The application owns the picture object's reference count.

IPic

IPicture pointer. Valid when type is SFT_PICTURE_IPICTURE. The application owns the picture object's reference count.

hwndAnim

HWND of a Microsoft Animation control playing an AVI clip. Valid when type is SFT_PICTURE_AVI.

Initialization and ownership

Allocate a SFT_PICTURE on the stack or as a struct field; initialize it with Sft_InitPicture (or memset(0)) before its first use; populate it with one of the Sft_SetPicture* setters; and reset it with Sft_ClearPicture before deallocation or before assigning a different picture.

Resource ownership: the resources stored in a SFT_PICTURE - HBITMAP, HICON, HIMAGELIST, IPicture pointers, GDI+ Image objects, .NET IUnknown pointers, animation HWNDs - remain owned by the application. Sft_ClearPicture only zeroes the structure; it never destroys handles or releases COM references. Keep the resources alive for as long as the host control might use them (typically until the control is destroyed).

Per-product support: not every DLL control supports every picture type. Each product's documentation lists the picture types it accepts.

See Also SftPicture2 | SFT_PICTURE_* | SFT_PICALIGN_* | SFT_TEXT | Sft_InitPicture | Sft_SetPictureBitmap


Last Updated 05/09/2026 - (email)
© 2026 Softel vdm, Inc.