CPaintDC dm(this); // 用于绘制的设备上下文
CRect cltRect;
GetClientRect(&cltRect);
dm.FillSolidRect(0,0,cltRect.Width(),cltRect.Height(),RGB(0,0,0));
BITMAP bmp;
HBITMAP hBmp;
HDC hDC;
GetClientRect(&cltRect);
hBmp = ::LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_QUMUKUANG));
::GetObject(hBmp, sizeof(bmp), &bmp);
hDC = ::CreateCompatibleDC(NULL);
SelectObject(hDC, hBmp);
BitBlt(dc, 0, 162, 480,32, hDC, 0, 0, SRCCOPY);
::DeleteObject(hBmp);
::DeleteDC(hDC);
本文介绍了一种使用CPaintDC进行绘图的方法,并详细展示了如何加载和显示位图资源。通过实例代码,读者可以了解到如何创建设备上下文、填充背景色及加载位图等操作。
5020

被折叠的 条评论
为什么被折叠?



