Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ItemPictureAlign

Defines whether item pictures of items are aligned with the cells of the immediate parent level.

C

BOOL WINAPI SftTree_GetItemPictureAlign(HWND hwndCtl);
void WINAPI SftTree_SetItemPictureAlign(HWND hwndCtl, BOOL fSet);
BOOL WINAPI SftTreeSplit_GetItemPictureAlign(HWND hwndCtl);
void WINAPI SftTreeSplit_SetItemPictureAlign(HWND hwndCtl, BOOL fSet);

C++

BOOL CSftTree::GetItemPictureAlign() const;
void CSftTree::SetItemPictureAlign(BOOL fSet = TRUE);
BOOL CSftTreeSplit::GetItemPictureAlign() const;
void CSftTreeSplit::SetItemPictureAlign(BOOL fSet = TRUE);

Parameters

hwndCtl

The window handle of the tree control.

fSet

Set to TRUE to align item pictures of items with the cells of the immediate parent item.

Returns

GetItemPictureAlign returns a value indicating whether item pictures of items are aligned with the cells of the immediate parent level.

Comments

The GetItemPictureAlign and SetItemPictureAlign functions define whether item pictures of items are aligned with the cells of the immediate parent level.

As items are indented based on their levels, the width of the indentation is determined by the width of the expand/collapse button bitmaps, the width of the item pictures and the default font used for the tree control. By using SetItemPictureAlign(TRUE), item pictures of items at a lower level can be aligned with the cell of the immediate parent level.

If the SetIndentation function is used to define the exact indentation for item levels, the SetItemPictureAlign function defines whether tree lines are connected to the parent's item picture or simply centered within the parent's cell.

In a variable height tree control, item pictures may be of varying widths and heights. If item pictures are smaller than the maximum width registered using SetPictures, the item pictures are horizontally centered within the space available for item pictures. This results in (smaller) item pictures not aligned with the cells of the parent level.

Get/SetItemBitmapAlign is a synonym for Get/SetItemPictureAlign.

Examples

C

            Sft_SetPictureBitmap(&m_aThreeItemPictures[1], m_BitmapOpen);/* Expanded picture */
            Sft_SetPictureBitmap(&m_aThreeItemPictures[2], m_BitmapLeaf);/* Leaf picture */
        }
        SftTree_SetPictures(g_hwndTree, m_aThreeItemPictures);/* Use item picture */
        /* Override individual item pictures using: */
        // Sft_InitPicture(&m_OtherItemPicture);
        // Sft_SetPictureBitmap(m_OtherItemPicture, LoadBitmap(app_instance, MAKEINTRESOURCE(IDB_your_bitmap)));/* Item picture */
        // SftTree_SetItemPicture(g_hwndTree, index, m_OtherItemPicture);/* Set an item bitmap */
        SftTree_SetItemPictureAlign(g_hwndTree, TRUE);/* Align item bitmaps */
        /* Register the cell picture size.  All cell pictures used */
        /* must be the same size.  Only one picture needs to be    */
        /* registered, even if several are used.                   */
        {
            SFTTREE_CELLINFOPARM CellInfo;
            CellInfo.version = 7;            
            CellInfo.index = -1;             /* Registering picture size */

C++

        Sft_SetPictureBitmap(&aPic[1], m_BitmapOpen);/* Expanded picture */
        Sft_SetPictureBitmap(&aPic[2], m_BitmapLeaf);/* Leaf picture */
    }
    m_Tree.SetPictures(aPic);        /* Use item pictures */
    /* Override individual item bitmaps using: */
    // m_OtherItemPicture.LoadBitmap(IDB_your_bitmap);/* Item bitmap */
    // Sft_SetPictureBitmap(&Pic, m_OtherItemPicture);/* Assign bitmap */
    // m_Tree.SetItemPicture(index, &Pic);/* Set an item picture */
    m_Tree.SetItemPictureAlign(TRUE);    /* Align item bitmaps */
    /* Register the cell picture size.  All cell pictures used */
    /* must be the same size.  Only one picture needs to be    */
    /* registered, even if several are used.                   */
    {
        SFTTREE_CELLINFOPARM CellInfo;
        CellInfo.version = 7;            
        CellInfo.index = -1;             /* Registering picture size */

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