You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB
C++

#include "StdAfx.h"
#include "FontType.h"
CFontType::CFontType(void)
{
m_CurFontNameIdx = 0;//当前选择的字体名字索引值
}
CFontType::~CFontType(void)
{
}
void CFontType::UpdateFontNameComb(CComboBox &Comb)
{
vector<CString>::iterator iter = m_FontNameVec.begin();
vector<CString>::iterator iter_end = m_FontNameVec.end();
for(int i=0;iter!=iter_end;iter++,i++)
{
Comb.InsertString(i,m_FontNameVec[i]);
}
Comb.SetCurSel(m_CurFontNameIdx);
}
CString CFontType::GetCurFontName()
{
CString name;
int size = m_FontNameVec.size();
if(m_CurFontNameIdx>=0 && m_CurFontNameIdx<size)
{
name = m_FontNameVec[m_CurFontNameIdx];
}
return name;
}
//通过比较名字来设置当前选择的字体
bool CFontType::SetCurFontByName(CString FontName)
{
vector<CString>::iterator iter = m_FontNameVec.begin();
vector<CString>::iterator iter_end = m_FontNameVec.end();
for(int i=0;iter!=iter_end;iter++,i++)
{
if((*iter) == FontName)//找到匹配
{
m_CurFontNameIdx = i;//设置为当前选中项
return true;
}
}
return false;
}