⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fontcombo.cpp

📁 VC++编程百例
💻 CPP
字号:
// FontCombo.cpp : implementation file
//

#include "stdafx.h"
#include "FontChoose.h"
#include "FontCombo.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CFontCombo

CFontCombo::CFontCombo()
{
}

CFontCombo::~CFontCombo()
{
}


BEGIN_MESSAGE_MAP(CFontCombo, CComboBox)
	//{{AFX_MSG_MAP(CFontCombo)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFontCombo message handlers

void CFontCombo::PreSubclassWindow() 
{
	ProcessFonts();
	CComboBox::PreSubclassWindow();
}
void CFontCombo::ProcessFonts(void)
{
	POSITION pos;
	LOGFONT lf;
	memset( (void *)&lf,0,sizeof(lf) );
	lf.lfCharSet=DEFAULT_CHARSET;

	m_FontList.RemoveAll();
	::EnumFontFamiliesEx( GetParent()->GetDC()->GetSafeHdc(), &lf, (FONTENUMPROC) CFontCombo::EnumFontFamiliesCallBack, (LPARAM) &m_FontList, 0);
	ResetContent();
	for(pos = m_FontList.GetHeadPosition(); pos != NULL;)
		AddString(m_FontList.GetNext(pos));
}

int CALLBACK CFontCombo::EnumFontFamiliesCallBack(ENUMLOGFONT *lpelfe,NEWTEXTMETRIC *lpntme,int FontType,LPARAM lParam)
{
	if( strlen((char*)lpelfe->elfFullName) != 0 )
	{
		CStringList* list = (CStringList*) lParam;
		list->AddTail((char*)lpelfe->elfFullName);
	}
	return 1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -