?? config.cpp
字號:
// Config.cpp: implementation of the CConfig class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "TipReader.h"
#include "Config.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CConfig::CConfig()
{
}
CConfig::~CConfig()
{
}
void CConfig::Serialize(CArchive &ar)
{
if(ar.IsLoading())
{
CString fname;
ar>>this->m_path;
ar>>this->m_filename;
ar>>this->m_poision;
ar>>this->m_txtcolor;
ar>>this->m_bkgcolor;
LOGFONT m_logfont;
ar.Read((BYTE *)(&m_logfont),sizeof(LOGFONT));
this->m_font.CreateFontIndirect(&m_logfont);
int length,i;
POSITION psn;
CString str;
ar>>length;
if(length!=0)
{
this->m_pathlist.RemoveAll();
ar>>str;
psn=this->m_pathlist.AddHead(str);
for(i=1;i<length;i++)
{
ar>>str;
psn=m_pathlist.InsertAfter(psn,str);
}
}
}
else
{
LOGFONT m_logfont;
this->m_font.GetLogFont(&m_logfont);
ar<<this->m_path;
ar<<this->m_filename;
ar<<this->m_poision;
ar<<this->m_txtcolor;
ar<<this->m_bkgcolor;
ar.Write((BYTE *)(&m_logfont),sizeof(LOGFONT));
int length,i;
length=this->m_pathlist.GetCount();
ar<<length;
for(i=0;i<length;i++)
{
ar<<this->m_pathlist.GetAt(this->m_pathlist.FindIndex(i));
}
}
}
BOOL CConfig::InsertPath(CString path)
{
int length,i;
length=this->m_pathlist.GetCount();
for(i=0;i<length;i++)
{
if(path==this->m_pathlist.GetAt(this->m_pathlist.FindIndex(i)))
break;
}
if(i==length)
{
this->m_pathlist.InsertAfter(this->m_pathlist.FindIndex(length-1),path);
return TRUE;
}
return FALSE;
}
BOOL CConfig::RemovePath(CString path)
{
int length,i;
length=this->m_pathlist.GetCount();
for(i=0;i<length;i++)
{
if(path==this->m_pathlist.GetAt(this->m_pathlist.FindIndex(i)))
break;
}
if(i!=length)
{
this->m_pathlist.RemoveAt(this->m_pathlist.FindIndex(i));
return TRUE;
}
return FALSE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -