Nikolay Sivov : comctl32/treeview: Item text should be vertically aligned.

Alexandre Julliard julliard at winehq.org
Mon May 23 13:24:57 CDT 2011


Module: wine
Branch: master
Commit: a1f7c09b1c0b3dccf05975970d978b5f309049c3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a1f7c09b1c0b3dccf05975970d978b5f309049c3

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri May 20 11:13:55 2011 +0400

comctl32/treeview: Item text should be vertically aligned.

---

 dlls/comctl32/treeview.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 490f9b2..de4edf5 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);
 	    }
-
 	}
     }
 




More information about the wine-cvs mailing list