CBitmap和HBITMAP的区别及相互转换方法

CBitmap和HBITMAP的区别及相互转换方法 

2008-06-16 08:05:03

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); 

你可能感兴趣的:(CBitmap和HBITMAP的区别及相互转换方法)