MemDC - & gt; FillRect (& amp; ClientRECT, & amp; BackBrush);
//1, from the application executable file loading of the existing bitmap resources, start assembly context
CBitmap mybitmap;
Int Width=1016;//bitmap width
Int Height=712;//bitmap height
Cstrings FiguerName;
FiguerName="C:/Users/Administrator/Desktop/PC - 201812261346 radar. The BMP";//bitmap path
If (mybitmap LoadBitmap (FiguerName))//loaded bitmap
{
BITMAP bm.
Mybitmap. GetBitmap (& amp; Bm);//for detailed bitmap information
The CDC * pDC.
PDC=this - & gt; GetDC ();
MemDC=new CDC ();
MemDC - & gt; TextOut (20, 20, L "BMP resource have had the loaded:");
MemDC - & gt; CreateCompatibleDC (clientDC);//create a compatible memory DC
MemDC - & gt; SelectObject (& amp; Mybitmap);//memory DC select bitmap object
MemDC - & gt; BitBlt (30, 30, Width, Height, memDC, 0, 0, SRCCOPY);//use the map function displays a bitmap from a memory DC content from the original equipment (for copying bitmap to the destination)
The ReleaseDC (clientDC);
CodePudding user response:

Pay attention to the single forward slash, or easy to escape, or easy to eat, to the double slash,
CodePudding user response:
Has been changed to double slash, but display bitmap or not, I set a breakpoint debugging and judge if there is no go in, so there was no image displayCodePudding user response:
LoadBitmapThe LoadBitmap function loads The specified bitmap resource the from a module 's the executable file. This function has had been superseded by theLoadImage function.
HBITMAP LoadBitmap (
HINSTANCE HINSTANCE,//handle to the application instance
LPCTSTR lpBitmapName//address of the bitmap resource name
);
Such as
HBitmap=LoadBitmap (hInstance, MAKEINTRESOURCE (IDB_BITMAP1));
CodePudding user response:
HImage=LoadImage (NULL, ofn. LpstrFile IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE | LR_CREATEDIBSECTION);
CodePudding user response:
COleStreamFile osf;//data flow load exe resources
Osf. CreateMemoryStream (NULL);
Osf. Write (pImage, 1024 * 10);
Osf. SeekToBegin ();
CImage image;
If (SUCCEEDED (image. The Load (osf) GetStream ())))
{
Auto pWnd=GetDlgItem (IDC_BMP);//here is to obtain control handle
The CDC * pDC=pWnd - & gt; GetDC ();
HDC HDC=pDC - & gt; M_hDC;
CRect rect_frame;
PWnd - & gt; GetClientRect (& amp; Rect_frame);
: : SetStretchBltMode (hDC, HALFTONE);//tensile
: : SetBrushOrgEx (hDC, 0, 0, NULL);//start
Image. The Draw (hDC, rect_frame);
The ReleaseDC (pDC);//release picture control DC
}
CodePudding user response:
Slash paths are obstacle
CodePudding user response:
CImage: : the Load () is the most simple, or use the API LoadImageCodePudding user response:
C: \ \ Users \ \ Administrator \ \ Desktop \ \ PC - 201812261346 radar. The BMPCodePudding user response:
Can a breakpoint IF place, look at the path is normal