On 23.03.2015 10:51, Mark Harmstone wrote:
Hi, Mark. Thanks for looking into this.
if (theme) {
LOGFONTW lf;
HRESULT hr = GetThemeFont(theme, hdc, HP_HEADERITEM, state, TMT_FONT, &lf);
if (SUCCEEDED(hr)) {
font = CreateFontIndirectW(&lf);
if (!font)
TRACE("Failed to create font\n");
else {
TRACE("font = %s\n", debugstr_w(lf.lfFaceName));
oldfont = SelectObject(hdc, font);
created_font = TRUE;
}
} else {
font = (HFONT)SendMessageW(infoPtr->hwndSelf, WM_GETFONT, 0, 0);
oldfont = SelectObject(hdc, font);
}
}
DrawTextW (hdc, phdi->pszText, -1, &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT); cw = textRect.right - textRect.left + 2 * infoPtr->iMargin;
if (font) SelectObject(hdc, oldfont);
if (created_font) DeleteObject(font);
This seems to essentially duplicate GetThemeTextExtent(). Any reason why you can't use it instead?