19,472
社区成员




void CDrawLinesDoc::Serialize(CArchive& ar)
{
//
CMainFrame *pfrm=(CMainFrame *)AfxGetMainWnd();
CDrawLinesView *pvw=(CDrawLinesView *)pfrm->GetActiveView();
//
CFile* pFile = ar.GetFile();
if (ar.IsStoring())
{
// TODO: add storing code here
list<LINE>::iterator pLine;
for(pLine=pvw->m_listAllLine.begin();pLine!=pvw->m_listAllLine.end();pLine++)
{
pFile->Write(&pLine->pStart,sizeof(CPoint));
pFile->Write(&pLine->pEnd,sizeof(CPoint));
}
}
else
{
// TODO: add loading code here
pvw->m_listAllLine.clear();
struct LINE lTemp;
UINT rdCount;
do
{
rdCount=pFile->Read(<emp.pStart,sizeof(CPoint));
rdCount=pFile->Read(<emp.pEnd,sizeof(CPoint));
pvw->m_listAllLine.push_back(lTemp);
} while (rdCount > 0);
pvw->Invalidate();
}
}