📄 fontcombo.cpp
字号:
// FontCombo.cpp : implementation file
//
#include "stdafx.h"
#include "VisualJava.h"
#include "FontCombo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFontCombo
#define ICON_DELTA 2
#define TEXT_DELTA 2
#define ICON_WIDTH 12
#define ICON_COUNT 2
CFontCombo::CFontCombo()
{
}
CFontCombo::~CFontCombo()
{
}
BEGIN_MESSAGE_MAP(CFontCombo, CComboBox)
//{{AFX_MSG_MAP(CFontCombo)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFontCombo message handlers
void CFontCombo::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC *pDC = CDC::FromHandle (lpDrawItemStruct->hDC);
CRect rc = lpDrawItemStruct->rcItem;
rc.left += ICON_DELTA;
int iImage = GetItemData (lpDrawItemStruct->itemID);
if (iImage)
{
m_imagelistType.Draw (pDC, iImage, rc.TopLeft (), ILD_TRANSPARENT);
}
rc.left += ICON_WIDTH;
if (lpDrawItemStruct->itemState & ODS_SELECTED)
{
pDC->SetTextColor (::GetSysColor (COLOR_HIGHLIGHTTEXT));
pDC->SetBkColor (::GetSysColor (COLOR_HIGHLIGHT));
}
else
{
pDC->SetTextColor (::GetSysColor (COLOR_WINDOWTEXT));
pDC->SetBkColor (::GetSysColor (COLOR_WINDOW));
}
CString sText;
GetLBText (lpDrawItemStruct->itemID, sText);
CSize sz = pDC->GetTextExtent (sText);
rc.right = rc.left + sz.cx + (TEXT_DELTA << 1);
pDC->ExtTextOut (rc.left + TEXT_DELTA, rc.top, ETO_OPAQUE, rc, sText, NULL);
if (lpDrawItemStruct->itemState & ODS_FOCUS && GetFocus () == this)
{
pDC->DrawFocusRect (rc);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -