Professional Documents
Culture Documents
Unit Iii CS
Unit Iii CS
class. Be sure to make them public member functions, since they must be accessible to the
view.
Modify the Serialize function that AppWizard included in the document class to serialize
m_clrGrid and m_clrCurrentColor.
Implement the view's OnDraw function. AppWizard generates a do-nothing OnDraw
function; you write the code to perform application-specific duties.
The SdiSquares Application…
Add the WM_LBUTTONDOWN handler (OnLButtonDown) to the view. You can add the
message handler by hand or use ClassWizard to add it. I used ClassWizard.
Open the AppWizard-generated application menu for editing, delete the Edit menu, and add
the Color menu. Then write command and update handlers for the new menu items. As with
message handlers, you can add command and update handlers manually or you can add them
with ClassWizard's help.
SDI vs MDI
MDI
MDI application frame windows are derived from the class CMDIFrameWnd.
An MDI application has multiple child windows, each of which corresponds to an individual
document. Microsoft Word is a good example of an MDI application. When you run
AppWizard to create a new project, MDI is the default application type
The parent-child hierarchy of a Windows MDI application.
MDI application
MDI windows
MDI classes
An MDI application has two frame window classes and many frame objects
Base Class
CMDIFrameWnd
CMDIChildWnd
AppWizard-Generated Class
CMainFrame
CChildFrame
1
The MDI frame-view window relationship
• Splitter Windows
• A splitter window is a window that can be divided into two or more panes
horizontally, vertically, or both horizontally and vertically using movable splitter bars.
Each pane contains one view of a document's data. The views are children of the
splitter window, and the splitter window itself is normally a child of a frame window.
• Splitter windows
• Using splitter windows provided by MFC, a single document interface (SDI)
application can present two or more views of the same document in resizeable "panes"
that subdivide the frame window's client area
• In an SDI application, the splitter window is a child of the top-level frame window.
• In an MDI application, the splitter window is a child of an MDI document frame.
• Types of splitter windows
• static splitter window:
The numbers of rows and columns in a static splitter window are set when the splitter is
created and can't be changed by the user. The user is, however, free to resize individual rows
and columns. A static splitter window can contain a maximum of 16 rows and 16 columns.
For an example of an application that uses a static splitter, look no further than the Windows
Explorer. Explorer's main window is divided in half vertically by a static splitter window.