CBitmap和HBITMAP的区别及相互转换方法
HPEN hPen,hPen2;
CPen pen,pen2;
pen.Attach(hPen);
hPen2 = (HPEN)pen;
CBitmap bmp;
bmp.LoadBitmap(IDB_BITMAP1);
HBITMAP hbm = (HBITMAP)bmp;
CBitmap bmp1;
bmp1.Attach(hbm);
HBITMAP = CBitmap.m_hObject
CBitmap* = CBitmap.FromHandle(HBITMAP)
//已知HBITMAP hbit;
CBitmap cb;
cb.FromHandle(hbit);
//已知CBitmap cb;
HBITMAP hbit=(HBITMAP)cb;
CBitmap bmp;
HBITMAP hBmp;
相互转换:
hBmp=(HBITMAP)bmp.GetSafeHandle();
bmp.Attach(hBmp);
评论