News | Articles | Libraries | Developer Tools | Books | Forum Links | Search   
Sections:
 

QA: How can I create a "flat" tab control?

By Alexander Shargin, June 24, 2003.
Print version

Question

I created a tab control. I want it to look flat like tab controls in Settings applets and other standard apps. How can I do this?

Answer

To make your tab control looking flat, you should do two things: assign it TCS_BOTTOM style and send it CCM_SETVERSION message with wParam set to COMCTL32_VERSION, e. g.:

// "pure" API ::SendMessage(hTabCtrl, CCM_SETVERSION, COMCTL32_VERSION, 0); // MFC m_wndTabCtrl.SendMessage(CCM_SETVERSION, COMCTL32_VERSION);

Why do you need to do this? The matter is that on older Palm-size PC devices some controls (including tab controls) looked differently and Pocket PC libraries are backwards-compatible with those devices. So by default some controls are displayed the way they were displayed on Palm-size PC. If you want to use PocketPC-style flat look, you need to explicitly tell your controls to behave so. That's why CCM_SETVERSION message is required.

As to TCS_BOTTOM style, this style makes the tab control to draw its tabs at the bottom. You need this style becaue flat tab controls work incorrectly when tabs are located at the top. I don't know if it is a bug or a feature but in any case placing tabs at the bottom is a recommended design on Pocket PC since in this case the user can switch tabs without obscuring the screen with his/her hand.

Related resources:

Discuss

Discuss this article. Here you can write your comments and read comments of other developers.
Rate this article:     Poor Excellent    
 12345 
© 2001-2005 Pocket PC Developer Network, a division of Spb Software House