Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

ItemBitmapAlign

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

C

BOOL WINAPI SftTree_GetItemBitmapAlign(HWND hwndCtl);
void WINAPI SftTree_SetItemBitmapAlign(HWND hwndCtl, BOOL fSet);
BOOL WINAPI SftTreeSplit_GetItemBitmapAlign(HWND hwndCtl);
void WINAPI SftTreeSplit_SetItemBitmapAlign(HWND hwndCtl, BOOL fSet);

C++

BOOL CSftTree::GetItemBitmapAlign() const;
void CSftTree::SetItemBitmapAlign(BOOL fSet = TRUE);
BOOL CSftTreeSplit::GetItemBitmapAlign() const;
void CSftTreeSplit::SetItemBitmapAlign(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

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

Comments

The GetItemBitmapAlign and SetItemBitmapAlign 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 SetItemBitmapAlign(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 defines whether tree lines are aligned with 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/SetItemPictureAlign is a synonym for Get/SetItemBitmapAlign.

Examples

C

        /* must be the same size.                                  */
        Sft_InitPicture(&m_aThreeItemPictures[0]);
        Sft_InitPicture(&m_aThreeItemPictures[1]);
        Sft_InitPicture(&m_aThreeItemPictures[2]);
        Sft_SetPictureBitmap(&m_aThreeItemPictures[0], LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_EXPANDABLE)));/* Expandable picture */
        Sft_SetPictureBitmap(&m_aThreeItemPictures[1], LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_EXPANDED)));/* Expanded picture */
        Sft_SetPictureBitmap(&m_aThreeItemPictures[2], LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_LEAF)));/* Leaf picture */
        SftTree_SetPictures(m_hwndLeftTree, m_aThreeItemPictures);/* Use item picture */
        SftTree_SetItemBitmapAlign(m_hwndLeftTree, TRUE);/* Align item bitmaps */
        SftTree_SetTreeLineStyle(m_hwndLeftTree, SFTTREE_TREELINE_DOT0);/* Dotted tree lines (incl. level 0) */
        SftTree_SetShowButtons(m_hwndLeftTree, TRUE);/* Expand/collapse buttons (level 1..n) */
        SftTree_SetShowButton0(m_hwndLeftTree, TRUE);/* Show expand/collapse buttons (level 0) */
        SftTree_SetButtons(m_hwndLeftTree, SFTTREE_BUTTON_SIMPLE);/* Button style */
        SftTree_SetShowTruncated(m_hwndLeftTree, TRUE);/* Show ... if truncated */
        SftTree_SetSelectionStyle(m_hwndLeftTree, SFTTREE_SELECTION_CELL1);/* Select first cell only */
        SftTree_SetSelectionArea(m_hwndLeftTree, SFTTREE_SELECTIONAREA_ALL);/* Selection changes by clicking anywhere on an item */

C++

        m_aThreeItemBitmaps[0].LoadBitmap(IDB_EXPANDABLE);/* Expandable bitmap */
        Sft_SetPictureBitmap(&aPic[0], m_aThreeItemBitmaps[0]);/* Assign bitmap */
        m_aThreeItemBitmaps[1].LoadBitmap(IDB_EXPANDED);/* Expanded bitmap */
        Sft_SetPictureBitmap(&aPic[1], m_aThreeItemBitmaps[1]);/* Assign bitmap */
        m_aThreeItemBitmaps[2].LoadBitmap(IDB_LEAF);/* Leaf bitmap */
        Sft_SetPictureBitmap(&aPic[2], m_aThreeItemBitmaps[2]);/* Assign bitmap */
        m_LeftTree.SetPictures(aPic);    /* Use item pictures */
    }
    m_LeftTree.SetItemBitmapAlign(TRUE); /* Align item bitmaps */
    m_LeftTree.SetTreeLineStyle(SFTTREE_TREELINE_DOT0);/* Dotted tree lines (incl. level 0) */
    m_LeftTree.SetShowButtons(TRUE);     /* Expand/collapse buttons (level 1..n) */
    m_LeftTree.SetShowButton0(TRUE);     /* Show expand/collapse buttons (level 0) */
    m_LeftTree.SetButtons(SFTTREE_BUTTON_SIMPLE);/* Button style */
    m_LeftTree.SetShowTruncated(TRUE);   /* Show ... if truncated */
    m_LeftTree.SetSelectionStyle(SFTTREE_SELECTION_CELL1);/* Select first cell only */
    m_LeftTree.SetSelectionArea(SFTTREE_SELECTIONAREA_ALL);/* Selection changes by clicking anywhere on an item */

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