-
Book Overview & Buying
-
Table Of Contents
Microsoft Visual C++ Windows Applications by Example
By :
When the users choos
e the File
|
Open item, a file should be opened and read, when they choose the File
|
Save item, it should be written. Let us implement functions for loading and storing the rings. It is actually quite easy because the framework has already made most of the work. There is a function Serialize in the document class, the framework will call it for reading or writing data. We just have to add a few lines of code to Serialize in the document class. The MFC class CArray has built-in functionality to load and save the points and colors.
void CRingDoc::Serialize(CArchive& ar)
{
m_pointArray.Serialize(ar);
m_colorArray.Serialize(ar);
if (ar.IsStoring())
{
ar << m_nextColor;
}
else
{
ar >> m_nextColor;
}
}Finally, we also ought to call the MFC method SetModifiedFlag in MouseDown in order to make sure the user cannot end the program without a warning about unsaved data.
void CRingDoc::MouseDown(CPoint...
Change the font size
Change margin width
Change background colour