Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

GDIPlusAvailable

Returns whether GDI+ support is available.

C

void WINAPI SftTree_GetGDIPlusAvailable(HWND hwndCtl);
void WINAPI SftTreeSplit_GetGDIPlusAvailable(HWND hwndCtl);

C++

BOOL CSftTree::GetGDIPlusAvailable() const;
BOOL CSftTreeSplit::GetGDIPlusAvailable() const;

Parameters

hwndCtl

The window handle of the tree control.

Returns

GetGDIPlusAvailable returns TRUE if GDI+ is available on the current system, otherwise FALSE is returned.

Comments

The GetGDIPlusAvailable function returns whether GDI+ support is available.

In order to use GDI+ images (see Sft_SetPictureGDIPlusImage), GDI+ support must be available. For information about distributing GDI+ with your application, please see "Distributing the Dlls".

Examples

C

        // Sft_SetPictureBitmap(&Pic, a_bitmap_handle);
        // SftTree_SetItemLabelPicture(g_hwndTree, index, &Pic);/* Set a label picture */
        /* Register the item pictures.  These pictures are used    */
        /* for all items in the tree control. All three pictures   */
        /* must be the same size.                                  */
        Sft_InitPicture(&m_aThreeItemPictures[0]);
        Sft_InitPicture(&m_aThreeItemPictures[1]);
        Sft_InitPicture(&m_aThreeItemPictures[2]);
        if (SftTree_GetGDIPlusAvailable(g_hwndTree)) {
            // In this example, we are using GDI+ images.
            // Even though this is a C application, we can embed the images as resources 
            // and use SftTree's SftTree_LoadGDIPlusImageFromResource function to load them
            // from a resource.
            // GDI+ images CANNOT be added as BITMAP resources. They are always added with
            // a custom resource type, in this example we use "PNG".
            m_FolderClosed = SftTree_LoadGDIPlusImageFromResource(g_hInst, TEXT("PNG"), MAKEINTRESOURCE(IDR_FOLDERCLOSED));

C++

    /* Register the item pictures.  These pictures are used    */
    /* for all items in the tree control. All three pictures   */
    /* must be the same size.                                  */
    SFT_PICTURE aPic[3];
    Sft_InitPicture(&aPic[0]);
    Sft_InitPicture(&aPic[1]);
    Sft_InitPicture(&aPic[2]);

    if (m_Tree.GetGDIPlusAvailable()) {
        // In this example, we are using GDI+ images.
        // GDI+ images CANNOT be added as BITMAP resources. They are always added with
        // a custom resource type, in this example we use "PNG".
        m_FolderClosed = (Gdiplus::Image*)SftTree_LoadGDIPlusImageFromResource(AfxGetApp()->m_hInstance, _T("PNG"), MAKEINTRESOURCE(IDR_FOLDERCLOSED));
        m_FolderOpen = (Gdiplus::Image*)SftTree_LoadGDIPlusImageFromResource(AfxGetApp()->m_hInstance, _T("PNG"), MAKEINTRESOURCE(IDR_FOLDEROPEN));
        m_FolderLeaf = (Gdiplus::Image*)SftTree_LoadGDIPlusImageFromResource(AfxGetApp()->m_hInstance, _T("PNG"), MAKEINTRESOURCE(IDR_FOLDERLEAF));
        Sft_SetPictureGDIPlusImage(&aPic[0], m_FolderClosed);

See Also C/C++ API | Categories | Notifications