Tony Teng
Tony Teng

Reputation: 125

How to customize MFC MDI CMFCTabCtrl

I've created MDI application based on MFC framework but the style of CMFCTabCtrl's doesn't satisfy our requirements. I want to change the tab height, colors and add some pictures and buttons.

But I don't know how. Are there any examples or articles that will help me out?

Upvotes: 2

Views: 1119

Answers (1)

Andrew Komiagin
Andrew Komiagin

Reputation: 6566

You can easily customize your MFC Tab control. There are plenty of options.

To enable Close buttons you just need to call m_TabControl.EnableActiveTabCloseButton();

Make sure to add a WM_CLOSE message handler in your child window:

void CMyTabWindow::OnClose()
{
    CMFCTabCtrl *pTab = static_cast<CMFCTabCtrl*>(GetParent());
    pTab->RemoveTab(pTab->GetActiveTab());
}

You can customize colors using SetTabBkColor() or SetAutoColors().

You can also set images using SetImageList().

The height can also be customized using SetTabsHeight().

Upvotes: 3

Related Questions