Visual C++ and MFC Fundamentals Chapter 8 GDI Orientation and Transformations
Practical Learning: Loading a Bitmap
- Start a new project and name it Bitmap1
- Create it as a Single Document application based on CView
- In the Class View, expand everything and access the
CMainFrame::PreCreateWindow() method - Change its code as follows:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// The new width of the window's frame
cs.cx = 480;
// The new height of the window's frame
cs.cy = 490;
// Remove the Untitled thing
cs.style &= ~FWS_ADDTOTITLE;
return TRUE;
}
- In the Resource View, display the string table and change the IDR_MAINFRAME
Caption to
Lady on Phone\n\nBitmap\n\n\nBitmap1.Document\nBitmap Document - Right-click any folder and click Import...
- In the Import Resource dialog box, change the Files of Type to All Files and, in the
Look In combo box, change the folder to the one that holds the accompanying
exercises for this book. - Select lady.bmp
- Click Import. After the bitmap has been imported, you may receive a message box,
click OK - Right-click the new IDB_BITMAP1 resource and click Properties