Creating the Document
Scribble: MDI Drawing Application, Lesson 3
Tip If you prefer working from a printed tutorial, see in MSDN Library Help for details about printing a lesson, a set of topics, or a single topic.
This lesson and the next, Creating the View, cover Step 1 of Scribble. Begin with the files you created with AppWizard in Using AppWizard to Create the Starter Application for Scribble in Lesson 2. You’ll be working in the following files: StdAfx.h, ScribbleDoc.h, and ScribbleDoc.cpp. As you read this lesson, add or change all lines of code as instructed in the procedures. At the end of Lesson 4, your files should essentially resemble Scribble Step1 source files.
Suggested Reading
In this lesson, you’ll develop:
Scribble’s data —
CStroke
, a class that defines one “stroke” of a drawing.Scribble’s document —
CScribbleDoc
, an application-specific class derived from class CDocument, to contain and manage a list of strokes.Scribble’s serialization code — code that implements writing and reading documents.
Lesson 4, Creating the View, introduces views and develops the view class. The two lessons together introduce many of the fundamental concepts of the application framework: documents, views, drawing, messages, and serialization (file loading and saving). Because documents and views are intimately related, you need to implement both before Scribble is fully functional.
In later lessons, you’ll add features to Scribble incrementally: more menus, a working toolbar, a dialog box with automatic initialization and validation of its controls, scrolling, splitter windows, enhanced printing, full application Help support, and OLE server support.
Note You can find a finished example of this lesson's code in the Scribble Step1 sample source code directory.