From c9783c5b155177d4cc997dc6810599096a1394e9 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 20 Oct 2014 23:04:27 -0400 Subject: [PATCH] Implemented text cell drawing. --- wintable/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wintable/main.c b/wintable/main.c index 248cf17..fe5810e 100644 --- a/wintable/main.c +++ b/wintable/main.c @@ -311,6 +311,7 @@ static void drawItems(struct table *t, HDC dc, RECT cliprect) HBRUSH background; int textColor; WCHAR msg[100]; + RECT headeritem; // TODO check errors rsel.left = r.left; @@ -333,7 +334,13 @@ static void drawItems(struct table *t, HDC dc, RECT cliprect) SetTextColor(dc, GetSysColor(textColor)); FillRect(dc, &rsel, background); SetBkMode(dc, TRANSPARENT); - TextOutW(dc, r.left, y, msg, wsprintf(msg, L"Item %d", i)); + if (SendMessageW(t->header, HDM_GETITEMRECT, 0, (LPARAM) (&headeritem)) == 0) + abort(); + rsel.left = headeritem.left + SendMessageW(t->header, HDM_GETBITMAPMARGIN, 0, 0); + rsel.top = y; + rsel.right = headeritem.right; + rsel.bottom = y + tm.tmHeight; + DrawTextExW(dc, msg, wsprintf(msg, L"Item %d", i), &rsel, DT_END_ELLIPSIS | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE, NULL); y += tm.tmHeight; }