Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Tab control client area?

SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
I've got a problem with a tab control that I am using in my latest pet-project. I get the client area of a specified tab using "TCM_GETITEMRECT", but it is returning the area occupied by the tab itself, not the content area below the tabs. How do I get that client area?
[code]
//Try to get the client area of the third tab
::SendMessage(hHandle, TCM_GETITEMRECT, (WPARAM)2, (LPARAM)&rBounds);
[/code]
That's my current method, which works in getting a client area, but not the correct one. So how do I get the client area of the tab control. The client area below the tabs that you click on, that is.

*EDIT*

I added a few lines of code to see what the client area was, and it returned something that was WAY off. Here's the code.
[code]
wchar_t pBuffer[256];
::wsprintf(pBuffer, L"X: %d, Y: %d, W: %d, H: %d", rBounds.left, rBounds.top, rBounds.right, rBounds.bottom);
::MessageBox(this->Handle(), pBuffer, L"Debug", MB_OK);
[/code]
Those lines of code are right below the "SendMessage" line. I get back "X: 110, Y: 2, W: 177, H: 23". That maps to the second and third tab area, not the tab control client area. What in the world is wrong here?

*EDIT*

I figured out that if I call "GetClientRect()" on the main tab control and not one of the tabs, that I get the entire client area, including the area occupied by the tabs. This is no good since the tab size may vary depending on a user's font size. I can hard-code the program to add 24 units to the top and subtract 26 from the bottom, as well as adding 2 units to the left and subtracting 4 from the right. This makes it work, but when you change font sizes or even styles, this screws everything up again. I need to know how to get just the USABLE client are of the tab control. I don't need the area where the tabs themselves are.

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
Sign In or Register to comment.