How to draw image on a window?

后端 未结 2 1909
不知归路
不知归路 2020-12-08 22:51

I have created a window with createwindow() api using VS2005 in C++ on Windows Vista

My requirement is to draw an image (of any format) on that window. I am not usin

2条回答
  •  隐瞒了意图╮
    2020-12-08 23:21

    void LoadScreen(HWND hWnd) {
        RECT rect;
        HDC hdc = GetDC(hWnd);
        HBRUSH brush = CreatePatternBrush((HBITMAP)LoadImage(NULL, L"file.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE));
        GetWindowRect(hWnd, &rect);
        FillRect(hdc, &rect, brush);
        DeleteObject(brush);
        ReleaseDC(hWnd, hdc);
    }
    

提交回复
热议问题