Hide

SftTabs/DLL 6.5 - Tab Control

Display
Print

SFTTABS_DRAWBACKGROUNDPROC Type Definition

Defines the type of a user-supplied drawing callback routine called by SftTabs/DLL, which paints the tab page background.

typedef void (CALLBACK* SFTTABS_DRAWBACKGROUNDPROC)(HDC hDC,
    HWND hwndDlg, HWND hwndTab, SFTTABS_DWORD_PTR UserData);

Parameters

hDC

The device context used to paint the tab page background.

hwndDlg

The window handle of the dialog representing the tab page.

hwndTab

The window handle of the tab control containing the tab page.

UserData

An application specific value as supplied using SftTabs_TransparentControls or CSftTabsPage::m_lpfnDrawBackground.

Comments

SFTTABS_DRAWBACKGROUNDPROC defines the type of a user-supplied drawing callback routine called by SftTabs/DLL, which paints the tab page background.

The background drawing callback is defined using SftTabs_TransparentControls (C) or CSftTabsPage::m_lpfnDrawBackground (C++/MFC). It is called by SftTabs/DLL to allow the application to display a custom tab page background.

The callback function can retrieve tab control and tab settings, but no modifications should be made to the tab control in any way.

Backgrounds are only supported on Windows XP (using Common Controls version 6) and above. While it is possible to enable backgrounds for all environments, most Windows controls will not be rendered correctly. Background colors based on SFTTABS_TAB, colorClientArea are supported in all environments.

Example

This example paints a custom tab page background by filling the tab page with a tiled bitmap.

C

    ... tab page dialog procedure

    LRESULT lResult;
    if (SftTabs_HandleDialogMessage(hwndDlg, msg, wParam, lParam))
        return TRUE;
    if (SftTabs_TransparentControls(hwndDlg, Page2_DrawBackground, &msg, &wParam, &lParam, &lResult, SFTTABS_DRAWBG_OVERRIDETHEME, 0))
        return lResult;
}
void CALLBACK Page2_DrawBackground(HDC hDC, HWND hwndDlg, HWND hwndTab, SFTTABS_DWORD_PTR UserData)
{
    RECT rect;
    GetClientRect(hwndDlg, &rect);
    SftTabs_PaintTiledBitmap(hDC, m_hBackgroundBitmap, 0, 0, &rect);
}

C++

CSamplePage::CSamplePage(CWnd* pParent /*=NULL*/) : CSftTabsPage(CSamplePage::IDD, pParent)
{
    m_lpfnDrawBackground = SamplePage_DrawBackground;
    m_flagDrawBackground = SFTTABS_DRAWBG_OVERRIDETHEME;
    m_UserDataBackground = (SFTTABS_DWORD_PTR)this;
    m_BackgroundBitmap.LoadBitmap(IDB_BACKGROUND);
}

void CALLBACK SamplePage_DrawBackground(HDC hDC, HWND hwndDlg, HWND hwndTab, SFTTABS_DWORD_PTR UserData)
{
    CSamplePage* pThis = (CSamplePage*)UserData;
    RECT rect;
    GetClientRect(hwndDlg, &rect);
    SftTabs_PaintTiledBitmap(hDC, pThis->m_BackgroundBitmap, 0, 0, &rect);
}

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


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.