Created
February 23, 2017 23:42
-
-
Save dcalance/a73902cdf214f228f2729e5f97ad909c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case WM_DRAWITEM: | |
{ | |
LPDRAWITEMSTRUCT Item; | |
Item = (LPDRAWITEMSTRUCT)lParam; | |
SelectObject(Item->hDC, CreateFont(16, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, L"Calibri")); | |
FillRect(Item->hDC, &Item->rcItem, CreateSolidBrush(0)); | |
SelectObject(Item->hDC, CreateSolidBrush(0)); | |
if (Item->itemState & ODS_SELECTED) | |
{ | |
SetTextColor(Item->hDC, 0); | |
SelectObject(Item->hDC, CreateSolidBrush(0xFF00)); | |
SelectObject(Item->hDC, CreatePen(PS_SOLID, 2, 0xFF00)); | |
} | |
else | |
{ | |
SetTextColor(Item->hDC, 0x00FF00); | |
SelectObject(Item->hDC, CreatePen(PS_SOLID, 2, 0x00FF00)); | |
} | |
SetBkMode(Item->hDC, TRANSPARENT); | |
RoundRect(Item->hDC, Item->rcItem.left, Item->rcItem.top, Item->rcItem.right, Item->rcItem.bottom, 20, 20); | |
int len; | |
len = GetWindowTextLength(Item->hwndItem); | |
LPSTR lpBuff; | |
lpBuff = new char[len + 1]; | |
GetWindowTextA(Item->hwndItem, lpBuff, len + 1); | |
DrawTextA(Item->hDC, lpBuff, len, &Item->rcItem, DT_CENTER | DT_SINGLELINE | DT_VCENTER); | |
} | |
return 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment