16,471
社区成员
发帖
与我相关
我的任务
分享
C对话框::OnPaint()
{
CPaintDC dc(this);
dc.SetBkMode(TRANSPARENT);
CRect rect;
GetDlgItem(IDC_STLSVIEW)->GetWindowRect(&rect);
ScreenToClient(&rect);
CDC memDC; // 定义内存设备
CBitmap bmpBack,*pBmp;
BITMAP bitmap;
bmpBack.LoadBitmap(IDB_BITMAP1);
memDC.CreateCompatibleDC(&dc);
dc.SetStretchBltMode(COLORONCOLOR);
pBmp = memDC.SelectObject(&bmpBack);
bmpBack.GetBitmap(&bitmap);
dc.StretchBlt(rect.left,rect.top,rect.Width(),rect.Height(),
&memDC,0,0,bitmap.bmWidth,bitmap.bmHeight,SRCCOPY);
memDC.SelectObject(pBmp);
}