Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

CtlColors

Defines the tree control's color attributes.

C

void WINAPI SftTree_GetCtlColors(HWND hwndCtl, LPSFTTREE_COLORS lpColors);
void WINAPI SftTree_SetCtlColors(HWND hwndCtl, LPCSFTTREE_COLORS lpColors);
void WINAPI SftTreeSplit_GetCtlColors(HWND hwndCtl, LPSFTTREE_COLORS lpColors);
void WINAPI SftTreeSplit_SetCtlColors(HWND hwndCtl, LPCSFTTREE_COLORS lpColors);

C++

void CSftTree::GetCtlColors(LPSFTTREE_COLORS lpColors) const;
void CSftTree::SetCtlColors(LPCSFTTREE_COLORS lpColors);
void CSftTreeSplit::GetCtlColors(LPSFTTREE_COLORS lpColors) const;
void CSftTreeSplit::SetCtlColors(LPCSFTTREE_COLORS lpColors);

Parameters

hwndCtl

The window handle of the tree control.

lpColors

A pointer to a SFTTREE_COLORS structure containing the color definitions. GetCtlColors uses this structure to return the current color settings. SetCtlColors uses the contents of this structure to define the new color settings.

Comments

The GetCtlColors and SetCtlColors functions define the tree control's color attributes.

To modify a control's color attributes, the GetCtlColors function is used to retrieve its current attributes. The SFTTREE_COLORS structure can then be modified, setting the desired attributes. Finally, the control's colors are updated by a call to the SetCtlColors function.

An RGB value or a GetSysColor index value can be specified for all color values. If a color index is used, the high-order bit must be set (e.g., COLOR_WINDOW | 0x80000000L).

Many color settings have no effect when Windows themes are used.

Examples

C

        Sft_InitPicture(&Pic);
        Sft_SetPictureSizeOnly(&Pic, PIC_SIZEX, PIC_SIZEY);/* Row/column header picture */
        SftTree_SetRowColHeaderPicture(g_hwndTree, &Pic);/* Row/column picture */
        SftTree_SetRowColHeaderPictureStyle(g_hwndTree, SFTTREE_BMP_RIGHT);/* Row/column picture alignment */
        SftTree_SetCharSearchMode(g_hwndTree, SFTTREE_CHARSEARCH_ALLCHARS, -1);/* Consider all characters typed */
        /* Change the default colors */
        {
            SFTTREE_COLORS Colors;
            SftTree_GetCtlColors(g_hwndTree, &Colors);/* Get current color settings */
            Colors.colorTreeLines = COLOR_3DDKSHADOW | 0x80000000L;/* Tree line color */
            Colors.colorSelBgNoFocus = COLOR_BTNFACE | 0x80000000L;/* Selection background color (no input focus) */
            Colors.colorSelFgNoFocus = COLOR_BTNTEXT | 0x80000000L;/* Selection foreground color (no input focus) */
            SftTree_SetCtlColors(g_hwndTree, &Colors);/* Set new colors */
        }

        /*------------------------------------------------------------------------------*/

C++

    Sft_InitPicture(&Pic);               /* Initialize */
    Sft_SetPictureSizeOnly(&Pic, PIC_SIZEX, PIC_SIZEY);/* Row/column header picture */
    m_Tree.SetRowColHeaderPicture(&Pic);       /* Row/column picture */
    m_Tree.SetRowColHeaderPictureStyle(SFTTREE_BMP_RIGHT);/* Row/column picture alignment */
    m_Tree.SetCharSearchMode(SFTTREE_CHARSEARCH_ALLCHARS, -1);/* Consider all characters typed */
    /* Change the default colors */
    {
        SFTTREE_COLORS Colors;
        m_Tree.GetCtlColors(&Colors);    /* Get current color settings */
        Colors.colorTreeLines = COLOR_3DDKSHADOW | 0x80000000L;/* Tree line color */
        Colors.colorSelBgNoFocus = COLOR_BTNFACE | 0x80000000L;/* Selection background color (no input focus) */
        Colors.colorSelFgNoFocus = COLOR_BTNTEXT | 0x80000000L;/* Selection foreground color (no input focus) */
        m_Tree.SetCtlColors(&Colors);    /* Set new colors */
    }

    /*------------------------------------------------------------------------------*/

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