GDI +双缓冲[C ++]

时间:2017-10-31 10:13:28

标签: c++ double gdi+ gdi buffering

我的GDI代码存在问题。 我用C ++。 这是代码:

int main()
{


    DWORD pwdGDIStartup;
    GdiplusStartupInput GDIstartupInp;
    GdiplusStartup(&pwdGDIStartup, &GDIstartupInp, NULL);
    Pen pnPen_Blue(Gdiplus::Color(255, 0, 0, 255), 2.0F);
    PAINTSTRUCT  ps;

    LPCSTR LGameWindow = "Counter-Strike: Global Offensive";

    HWND hGameWindow = FindWindow(NULL, LGameWindow);
    Graphics graphics(GetDC(hGameWindow));

    WCHAR string[] = L"Das";

    HDC          hdc;
    HDC          hdcBuffer;
    hdc = BeginPaint(hGameWindow, &ps);

    int i = 10000;

    Font myFont(L"Arial", 10);
    RectF layoutRect(100.00f, 100.00f, 100.00f, 150.00f);
    StringFormat format;
    format.SetAlignment(StringAlignmentCenter);
    SolidBrush blackBrush(Color(255, 255, 100, 0));
    ;
    for (;;) {
        graphics.DrawString(
            string,
            11,
            &myFont,
            layoutRect,
            &format,
            &blackBrush);
        i++;
        graphics.DrawLine(&pnPen_Blue, 300, 700, 500, 600);
        graphics.DrawLine(&pnPen_Blue, 400, 700, 400, 600);

    }


}

0 个答案:

没有答案