Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

LoadImageFromResource Method, SftPictureObject Object

Loads an image from a resource as a GDI+ image.

Syntax

VB.NETobject.LoadImageFromResource(ByVal ResourceHandle As Integer, ByVal ResourceType As String, ByVal ResourceName As String)
VBobject.LoadImageFromResource(ByVal ResourceHandle As LONG_PTR, ByVal ResourceType As String, ByVal ResourceName As String)
C#.NETvoid object.LoadImageFromResource(int ResourceHandle, string ResourceType, string ResourceName);
VC++HRESULT object->LoadImageFromResource(LONG_PTR ResourceHandle, _bstr_t ResourceType, _bstr_t ResourceName);
CHRESULT object->raw_LoadImageFromResource(LONG_PTR ResourceHandle, BSTR ResourceType, BSTR ResourceName);

object

A SftPictureObject object.

ResourceHandle

The handle to an instance of the module containing the resource.

ResourceType

The resource type. Can be a string or an identifier using the MAKEINTRESOURCE macro.

ResourceName

The resource name. Can be a string or an identifier using the MAKEINTRESOURCE macro.

Comments

The LoadImageFromResource method loads an image from a resource as a GDI+ image.

This function is identical to the GDI+ function Gdiplus::Bitmap::FromResource().

The image object is owned by the tree control and will be deleted when it is no longer used.

Examples

C++

    C->Image->PutBitmapHandle((OLE_HANDLE)(HBITMAP) bmp);
    C->ImageHAlign = Align;
    PropagateImage(ItemIndex, C->Image);
}

void CPicturesDlg::UpdateImage(long ItemIndex, int resourceID, SftTreeHAlignConstants Align)
{
    ISftTreeCellPtr C = m_vTree->Cell[ItemIndex][0];
    C->Image->raw_LoadImageFromResource((long) AfxGetApp()->m_hInstance, L"PNG", (LPWSTR)MAKEINTRESOURCE(resourceID));
    C->ImageHAlign = Align;
    PropagateImage(ItemIndex, C->Image);
}

void CPicturesDlg::UpdateIcon(long ItemIndex, HICON hIcon, SftTreeHAlignConstants Align)
{
    ISftTreeCellPtr C = m_vTree->Cell[ItemIndex][0];

See Also SftPictureObject Object | Object Hierarchy


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