?? sample7doc.cpp
字號:
// sample7Doc.cpp : implementation of the CSample7Doc class
//
#include "stdafx.h"
#include "sample7.h"
#include "sample7Doc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSample7Doc
IMPLEMENT_DYNCREATE(CSample7Doc, CDocument)
BEGIN_MESSAGE_MAP(CSample7Doc, CDocument)
//{{AFX_MSG_MAP(CSample7Doc)
ON_COMMAND(ID_ADJUST_CLOSELINE, OnAdjustCloseline)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSample7Doc construction/destruction
CSample7Doc::CSample7Doc()
{
// TODO: add one-time construction code here
m_pCloseLine = NULL;
m_Sel = 0;
}
CSample7Doc::~CSample7Doc()
{
}
BOOL CSample7Doc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CSample7Doc serialization
void CSample7Doc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CSample7Doc diagnostics
#ifdef _DEBUG
void CSample7Doc::AssertValid() const
{
CDocument::AssertValid();
}
void CSample7Doc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSample7Doc commands
BOOL CSample7Doc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
CStdioFile fp;
CFileException e;
if( !fp.Open(lpszPathName, CFile::modeRead|CFile::typeText, NULL))
{
AfxGetApp()->m_pMainWnd->MessageBox("數據文件不存在或數據文件錯!","提示",MB_OK|MB_ICONWARNING);
return TRUE;
}
long MAXLINE = 255;
char strBuffer[255], buff[255];
fp.ReadString(buff,MAXLINE);
sscanf(buff, "%s",strBuffer);
// TODO: Add your specialized creation code here
if(!strcmpi(strBuffer,"CLOSE"))
{
fp.Close();
m_pCloseLine = new CCloseLine();
m_pCloseLine->ReadData(lpszPathName);
m_pCloseLine->WriteData(lpszPathName);
delete m_pCloseLine;
return TRUE;
}
return TRUE;
}
void CSample7Doc::OnAdjustCloseline()
{
// TODO: Add your command handler code here
CCloseLine m_close;
CFileDialog FileDlg(TRUE,NULL,"*.sdp",OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,"閉合導線數據文件名(*.sdp)|*.sdp|所有文件(*.*)|*.*||");
FileDlg.m_ofn.lpstrTitle="打開數據文件";
if(FileDlg.DoModal()==IDOK)
{
CString StrFile=FileDlg.GetPathName();
if(m_close.ReadData(StrFile))
{
m_close.MainProc();
m_close.WriteData(StrFile);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -