PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: 在此处添加使用 hdc 的任何绘图代码...
LPCWSTR text1 = TEXT("string test");
Rectangle(hdc, 0, 0, 400, 20);
COLORREF color1 = RGB(0, 255, 0);
COLORREF color2 = RGB(255, 0, 0);
::SetTextColor(hdc, color1);
::SetBkColor(hdc, color2);
::TextOut(hdc, 0, 0, text1, lstrlen(text1));
EndPaint(hWnd, &ps);
参考文献