Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

DrawSelectionOutline

Draws a selection outline.

C

void WINAPI SftTree_DrawSelectionOutline(HWND hwndCtl, HDC hDC, LPCRECT lpRect, 
        COLORREF OutlineBorder, COLORREF InnerBorder, COLORREF InnerFill1, COLORREF InnerFill2);
void WINAPI SftTreeSplit_DrawSelectionOutline(HWND hwndCtl, HDC hDC, LPCRECT lpRect, 
        COLORREF OutlineBorder, COLORREF InnerBorder, COLORREF InnerFill1, COLORREF InnerFill2);

C++

void CSftTree::DrawSelectionOutline(HDC hDC, LPCRECT lpRect, COLORREF OutlineBorder, 
        COLORREF InnerBorder, COLORREF InnerFill1, COLORREF InnerFill2) const;
int CSftTreeSplit::DrawSelectionOutline(HDC hDC, LPCRECT lpRect, COLORREF OutlineBorder, 
        COLORREF InnerBorder, COLORREF InnerFill1, COLORREF InnerFill2) const;

Parameters

hwndCtl

The window handle of the tree control.

HDC

The device context handle, where the selection outline is to be rendered.

lpRect

The location and size of the selection outline.

OutlineBorder

The outermost border color used to render the rounded selection outline rectangle.

InnerBorder

The inner border color used to render the rounded selection outline rectangle.

InnerFill1

The starting color (top) used to gradient fill the inside of the rounded selection outline rectangle.

InnerFill2

The ending color (bottom) used to gradient fill the inside of the rounded selection outline rectangle.

Comments

The DrawSelectionOutline function draws a rounded selection outline rectangle.

This function is normally only used with ownerdraw cells (see OwnerDrawCallback).

Examples

C

        DrawText(lpInfo->hDC, szText, -1, &r, DT_CALCRECT | DT_LEFT | DT_SINGLELINE);
        InflateRect(&r, lpInfo->gap/2, 0); 
        lpInfo->DrawRect = r;
    } else {
        // we need to paint the cell
        RECT r;
        FillRect(lpInfo->hDC, &lpInfo->DrawRect, (HBRUSH) (COLOR_3DFACE+1));
        if (lpInfo->fSelected)
            SftTree_DrawSelectionOutline(lpInfo->hwndCtl, lpInfo->hDC, &lpInfo->DrawRect, RGB(128,0,0), RGB(255,100,100), RGB(255,255,255), RGB(255,0,0));
        r = lpInfo->DrawRect;
        InflateRect(&r, -lpInfo->gap/2, 0);
        DrawText(lpInfo->hDC, szText, -1, &r, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
    }

    SelectObject(lpInfo->hDC, hOldFont);
}

C++

        lpInfo->DrawRect = r;
    } else {
        // we need to paint the cell
        RECT r;
        CBrush br;
        br.CreateSysColorBrush(COLOR_3DFACE);
        pDC->FillRect(&lpInfo->DrawRect, &br);
        if (lpInfo->fSelected)
            pTree->DrawSelectionOutline(lpInfo->hDC, &lpInfo->DrawRect, RGB(128,0,0), RGB(255,100,100), RGB(255,255,255), RGB(255,0,0));
        r = lpInfo->DrawRect;
        InflateRect(&r, -lpInfo->gap/2, 0);
        pDC->DrawText(strText, &r, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
    }

    pDC->SelectObject(pOldFont);
}

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