如何在OnPaint里用gdi+实现双缓冲画图

    // 创建内存DC
    CClientDC dc(this);
    CDC memdc;
    memdc.CreateCompatibleDC(&dc);
    CBitmap bmp;
    CRect rc;
    GetClientRect(&rc);
    bmp.CreateCompatibleBitmap(&dc, rc.Width(), rc.Height());
    memdc.SelectObject(&bmp);
    bmp.DeleteObject();

    // 创建GDI+画图对象
    Graphics graphics(memdc);
    Image image( ToWChar("1.jpg"));

    Point ShowMatrix[3] = 
    { 
        Point(0, 0), 
        Point(image.GetWidth(), 0), 
        Point(0, image.GetHeight()) 
    }; 
 
    // 开始画图
    graphics.DrawImage(&image, ShowMatrix, 3); 
    dc.BitBlt(0, 0, rc.Width(), rc.Height(), &memdc, 0, 0, SRCCOPY);

    // 清理内存
    memdc.DeleteDC();

转帖:http://topic.csdn.net/u/20091027/11/7c9a0389-5d56-4e17-afc4-76c73ef55c6e.html

你可能感兴趣的:(c,image,GDI+)