There is currently 1 post.
Font size: Small - 100% (Default)  Content converter: No conversion
 
Clicks Replies
1063 0
【案例】Win32程序GDI绘图案例
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 1 Posted at: 12/2/15 0:07
运行效果:


程序代码:
WndProc函数中的case WM_PAINT:部分:
case WM_PAINT:
        hdc = BeginPaint(hWnd, &ps);
        // TODO: Add any drawing code here...
        paint(hdc);
        EndPaint(hWnd, &ps);
        break;
其实就是调用paint函数。

paint函数:
void paint(HDC hdc)
{
    HPEN hpen;
    wchar_t *str = L"This is a string.";
    TextOut(hdc, 10, 10, str, wcslen(str));

    hpen = CreatePen(PS_SOLID, 1, RGB(0xff, 0x00, 0x00));
    SelectObject(hdc, hpen);
    MoveToEx(hdc, 50, 50, NULL);
    LineTo(hdc, 150, 100);
}
Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
(Shortcut key: Ctrl+Enter)
Post Information
Clicks: 1063 Replies: 0
Author: 巨大八爪鱼
Last reply: 巨大八爪鱼
Last reply time: 12/2/15 0:07
Bar Good Posts
Announcements