Home > Back-end >  MFC background image
MFC background image

Time:11-02

 
BOOL CMFCApplication3Dlg: : OnEraseBkgnd (pDC) CDC *
{
//TODO: add the message handler code and/or invoke the default
CBitmap bitmap.
Bitmap. LoadBitmapW (IDB_BITMAP1);
CClientDC CDC (this);
The CDC comdc;
Comdc. CreateCompatibleDC (& amp; The CDC);
Comdc. SelectObject (& amp; Bitmap);

//generated BITMAP
BITMAP bit;
Bitmap. GetBitmap (& amp; Bit);

//client area
CRect the rect.
GetClientRect (the rect);

//the DC of the client area are used to draw the generated BITMAP, and adapt to the window size
The CDC StretchBlt (0, 0, the rect. Width (), the rect. Height (), & amp; Comdc, 0, 0, bit bmWidth, bit. BmHeight, SRCCOPY);
return TRUE;
//return CDialogEx: : OnEraseBkgnd (pDC);
}

Although you can run, and can also display all images, but it can't fully display button, and transform, at run time button was gone, total want to find a button with the mouse roughly the location can be displayed,,,,

CodePudding user response:

Can response to a WM_PAINT message
  • Related