码迷,mamicode.com
首页 > 其他好文 > 详细

双缓冲技术

时间:2014-11-09 06:16:16      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   sp   div   on   art   log   

#ifndef _DRAW2D_H
#define _DRAW2D_H

#include <gdiplus.h>
#pragma comment(lib, "gdiplus")
using namespace Gdiplus;

HWND Draw2D_hwnd;

void Draw2D(PVOID pvoid)
{
    Sleep(1);
    ULONG_PTR gdipludToken;
    GdiplusStartupInput gdiplusInput;
    GdiplusStartup(&gdipludToken, &gdiplusInput, NULL);

    RECT rect;
    HDC hdc = GetDC(Draw2D_hwnd);
    GetClientRect(Draw2D_hwnd, &rect);
    Bitmap bmp(rect.right, rect.bottom);
    SolidBrush brush(Color(255, 255, 255));
    Graphics gbmp(&bmp);
    Graphics graphics(hdc);

    while (1) 
    {
        gbmp.FillRectangle(&brush, 0, 0, rect.right, rect.bottom);

        Image min_normal(TEXT("background.png"));
        gbmp.DrawImage(&min_normal, 0, 0, min_normal.GetWidth(), min_normal.GetHeight());

        graphics.DrawImage(&bmp, 0, 0, rect.right, rect.bottom);
    }

    ReleaseDC(Draw2D_hwnd, hdc);
    GdiplusShutdown(gdipludToken);
}

#endif

 

双缓冲技术

标签:style   blog   color   ar   sp   div   on   art   log   

原文地址:http://www.cnblogs.com/Susake/p/4084369.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!