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

📄 dledndlg.cpp

📁 wince下一个很有用的
💻 CPP
字号:
// DLEDNDlg.cpp : implementation file
//

#include "stdafx.h"
#include "DLEDN.h"
#include "DLEDNDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDLEDNDlg dialog

CDLEDNDlg::CDLEDNDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDLEDNDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDLEDNDlg)
		// 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_iFontSize = 36;
}

void CDLEDNDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDLEDNDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDLEDNDlg, CDialog)
	//{{AFX_MSG_MAP(CDLEDNDlg)
	ON_BN_CLICKED(IDC_BUTTON_ZOOMIN, OnButtonZoomin)
	ON_BN_CLICKED(IDC_BUTTON_ZOOMOUT, OnButtonZoomout)
	ON_WM_CTLCOLOR()
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDLEDNDlg message handlers

BOOL CDLEDNDlg::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

	// TODO: Add extra initialization here
	m_Font.CreateFont(
	   m_iFontSize,     // nHeight
	   0,								// nWidth
	   0,								// nEscapement
	   0,								// nOrientation
	   FW_BOLD,							// nWeight FW_BOLDFW_NORMAL
	   FALSE,							//bItalic
	   FALSE,							// bUnderline
	   0,								// cStrikeOut
	   ANSI_CHARSET,					// nCharSet
	   OUT_DEFAULT_PRECIS,				// nOutPrecision
	   CLIP_DEFAULT_PRECIS,				// nClipPrecision
	   DEFAULT_QUALITY,					// nQuality
	   DEFAULT_PITCH | FF_SWISS,		// nPitchAndFamily
	   _T("DigiNumLED"));
	GetDlgItem(IDC_STATIC_DLEDN)->SetFont(&m_Font);
	
	SetTimer(1,1000,NULL);

	return TRUE;  // return TRUE  unless you set the focus to a control
}



void CDLEDNDlg::OnButtonZoomin() 
{
	// TODO: Add your control notification handler code here
	if(m_iFontSize<16)
	{
		return;
	}
	m_iFontSize = m_iFontSize - 2;
	
	m_Font.CreateFont(
	   m_iFontSize,     // nHeight
	   0,								// nWidth
	   0,								// nEscapement
	   0,								// nOrientation
	   FW_BOLD,							// nWeight FW_BOLDFW_NORMAL
	   FALSE,							//bItalic
	   FALSE,							// bUnderline
	   0,								// cStrikeOut
	   ANSI_CHARSET,					// nCharSet
	   OUT_DEFAULT_PRECIS,				// nOutPrecision
	   CLIP_DEFAULT_PRECIS,				// nClipPrecision
	   DEFAULT_QUALITY,					// nQuality
	   DEFAULT_PITCH | FF_SWISS,		// nPitchAndFamily
	   _T("DigiNumLED"));
	GetDlgItem(IDC_STATIC_DLEDN)->SetFont(&m_Font);

}

void CDLEDNDlg::OnButtonZoomout() 
{
	// TODO: Add your control notification handler code here
	if(m_iFontSize>128)
	{
		return;
	}
	m_iFontSize = m_iFontSize + 2;
	
	m_Font.CreateFont(
	   m_iFontSize,     // nHeight
	   0,								// nWidth
	   0,								// nEscapement
	   0,								// nOrientation
	   FW_BOLD,							// nWeight FW_BOLDFW_NORMAL
	   FALSE,							//bItalic
	   FALSE,							// bUnderline
	   0,								// cStrikeOut
	   ANSI_CHARSET,					// nCharSet
	   OUT_DEFAULT_PRECIS,				// nOutPrecision
	   CLIP_DEFAULT_PRECIS,				// nClipPrecision
	   DEFAULT_QUALITY,					// nQuality
	   DEFAULT_PITCH | FF_SWISS,		// nPitchAndFamily
	   _T("DigiNumLED"));

	GetDlgItem(IDC_STATIC_DLEDN)->SetFont(&m_Font);
}

HBRUSH CDLEDNDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	if(pWnd->GetDlgCtrlID()==IDC_STATIC_DLEDN)
	{	
			pDC->SetTextColor(RGB(0,255, 0));
			pDC->SetBkColor(RGB(0,0,0));
	}
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

void CDLEDNDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	CString sSysTime;
	CTime tTime = CTime::GetCurrentTime();
	
	sSysTime.Format(_T("%d-%d-%d . %02d:%02d:%02d"),tTime.GetYear(),tTime.GetMonth(),tTime.GetDay(),tTime.GetHour(),tTime.GetMinute(),tTime.GetSecond());
	SetDlgItemText(IDC_STATIC_DLEDN,sSysTime);


	CDialog::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

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