📄 fonttestdlg.cpp
字号:
// FontTestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FontTest.h"
#include "FontTestDlg.h"
#include "Ini.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFontTestDlg dialog
CFontTestDlg::CFontTestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFontTestDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFontTestDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_lpDDPrimarySurface = NULL;
m_lpDD = NULL;
m_nRGB = 0;
}
void CFontTestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFontTestDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFontTestDlg, CDialog)
//{{AFX_MSG_MAP(CFontTestDlg)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
// ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFontTestDlg message handlers
BOOL CFontTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
SetWindowPos(&wndTop, 0, 0, 480, 243, SWP_SHOWWINDOW);
DDInit();
// TODO: Add extra initialization here
LOGFONT lf;
memset(&lf, 0 ,sizeof(lf));
lf.lfCharSet = CHINESEBIG5_CHARSET;
lf.lfHeight = 32;
lf.lfWeight = 900;
lstrcpy(lf.lfFaceName, _T("SC_Song"));
BOOL ok = m_font32.CreateFontIndirect(&lf);
lf.lfHeight = 16;
ok = m_font16.CreateFontIndirect(&lf);
lf.lfHeight = 8;
ok = m_font8.CreateFontIndirect(&lf);
return TRUE; // return TRUE unless you set the focus to a control
}
BOOL CFontTestDlg::DDInit()
{
//error checking
if ( (m_lpDD != NULL) || (m_lpDDPrimarySurface != NULL) )
return FALSE;
// Create the DirectDraw object.
if (DirectDrawCreate( NULL, &m_lpDD, NULL ) != DD_OK)
return FALSE;
// Set normal cooperative level.
if (m_lpDD->SetCooperativeLevel( NULL, DDSCL_NORMAL ) != DD_OK)
return FALSE;
// Create the primary surface.
DDSURFACEDESC ddsd; // Surface description structure.
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
if (m_lpDD->CreateSurface( &ddsd, &m_lpDDPrimarySurface, NULL ) != DD_OK)
return FALSE;
return TRUE;
}
void CFontTestDlg::Draw()
{
if(m_lpDDPrimarySurface == NULL) return;
HDC hdc = NULL;
m_lpDDPrimarySurface->GetDC(&hdc);
SetBkMode(hdc, TRANSPARENT);
CBrush br(RGB(200, 200, 255));
FillRect(hdc, &CRect(0, 0, 480, 243), (HBRUSH)br.GetSafeHandle());
TCHAR szTxt[4096];
GetPrivateProfileStringCE(_T("Maintain.Title"), _T("Name"), _T("
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -