Game Development Reference
In-Depth Information
BOOL CMFCSingleDocDoc::OnNewDocument()
if (!CDocument::OnNewDocument())
return FALSE;
rect.SetRect(100, 100, 300, 300);
return TRUE;
We draw the rectangle with the view shown in Figure B.9.
Figure B.9 A simple MFC Single document application.
The view class has a function already created by Visual C++ that allows
you to implement any drawing necessary. The OnDraw function is passed
a point to a device context class CDC . You can use this function to do any
drawing of the document you require. First, get hold of a pointer to your
document. The default AppWizard implementation includes a member
function to access the document, GetDocument() . With the device context
and the document pointer you can use a simple GDI (Graphics Device
Interface) function to draw a rectangle.
Search Nedrilad ::

Custom Search