From a1f7c09b1c0b3dccf05975970d978b5f309049c3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 20 May 2011 11:13:55 +0400 Subject: [PATCH] comctl32/treeview: Item text should be vertically aligned. --- dlls/comctl32/treeview.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 490f9b23a48..de4edf5134d 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -2621,6 +2621,8 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item) if (item->pszText) { RECT rcText; + UINT align; + SIZE sz; rcText.top = item->rect.top; rcText.bottom = item->rect.bottom; @@ -2631,19 +2633,22 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item) debugstr_w(item->pszText), wine_dbgstr_rect(&rcText)); /* Draw it */ - ExtTextOutW(hdc, rcText.left + 2, rcText.top + 1, + GetTextExtentPoint32W(hdc, item->pszText, strlenW(item->pszText), &sz); + + align = SetTextAlign(hdc, TA_LEFT | TA_TOP); + ExtTextOutW(hdc, rcText.left + 2, (rcText.top + rcText.bottom - sz.cy) / 2, ETO_CLIPPED | ETO_OPAQUE, &rcText, item->pszText, lstrlenW(item->pszText), NULL); - - /* Draw the box around the selected item */ + SetTextAlign(hdc, align); + + /* Draw focus box around the selected item */ if ((item == infoPtr->selectedItem) && inFocus) { DrawFocusRect(hdc,&rcText); } - } } -- 2.11.4.GIT