Advertisement

使用MFC (static) 加载图片

阅读量:

方法一:导入bmp文件

复制代码
    #define HBMP(filepath,width,hight) (HBITMAP)LoadImage(AfxGetInstanceHandle(),filepath,IMAGE_BITMAP,width,hight,LR_LOADFROMFILE|LR_CREATEDIBSECTION)
    
    	//宽高设置,应该按照控件大小取设置
    	CRect rect;
    	m_photoBmp.GetWindowRect(rect);
    
    	//静态控价设置bitmap
    	m_photoBmp.ModifyStyle(0xF, SS_BITMAP | SS_CENTERIMAGE);
    	m_photoBmp.SetBitmap(HBMP(photoFileName, rect.Width(), rect.Height()));
    
    
      
      
      
      
      
      
      
      
      
    
复制代码
    	HBITMAP hbitmap;
    	CRect rect;
    	m_photoBmp.GetWindowRect(&rect);
    	hbitmap = (HBIT

全部评论 (0)

还没有任何评论哟~