MFC中加载位图
2021-01-28 16:14
标签:led sel 位图 obj ati sele cto oid this MFC中加载位图 标签:led sel 位图 obj ati sele cto oid this 原文地址:https://www.cnblogs.com/veis/p/12838159.html(1)使用BitBlt
void CBRUSHTESTDlg::OnPaint()
{
CPaintDC dc(this);
CBitmap bmp;
bmp.LoadBitmap(IDB_BITMAP1);
BITMAP bitmap;
int size = bmp.GetBitmap(&bitmap);
CDC memDC;
memDC.CreateCompatibleDC(&dc);
memDC.SelectObject(&bmp);
dc.BitBlt(10, 10, bitmap.bmWidth, bitmap.bmHeight, &memDC, 0, 0, SRCCOPY); //向窗口中绘制位图
}
(2)使用StretchBlt
void CBRUSHTESTDlg::OnPaint()
{
CPaintDC dc(this);
CBitmap bmp;
bmp.LoadBitmap(IDB_BITMAP1);
BITMAP bitmap;
int size = bmp.GetBitmap(&bitmap);
CDC memDC;
memDC.CreateCompatibleDC(&dc);
memDC.SelectObject(&bmp);
dc.SetStretchBltMode(STRETCH_HALFTONE);
dc.StretchBlt(0, 0, bitmap.bmWidth, bitmap.bmHeight, &memDC, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY); //向窗口中绘制位图
}
上一篇:Java基础