views:

141

answers:

0

I have a groupbox (BS_GROUPBOX) like this:

http://i50.tinypic.com/34osspd.png (Sorry, new users like me cannot insert images directly)

The text of header is sets dynamicaly. I need to determine that current text fit width or not. I use GetTextExtentPoint() to determine string width (textWidth) and, of course, I know a size of control (ctrlRect). But how to get horizontal text offset for groupbox header? I need something like this:

GetWindowRect(...., &ctrlRect);
GetTextExtentPoint32(....., &textSize)
int textHOffset = ????;
bool bFit = ctrlRect.right - ctrlRect.left - textHOffset <= textSize.cx;

This size is depicted by two red lines on picture. So, how to get this size?