wzddlg.cpp

来自「MFC扩展编程实例」· C++ 代码 · 共 87 行

CPP
87
字号
// WzdDlg.cpp : implementation file
//

#include "stdafx.h"
#include "wzd.h"
#include "WzdDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CWzdDialog dialog


CWzdDialog::CWzdDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CWzdDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(CWzdDialog)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_bFlashText=FALSE;
	m_bFlashDlg=FALSE;
}


void CWzdDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CWzdDialog)
	DDX_Control(pDX, IDC_FLASHING_STATIC, m_ctrlStatic);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CWzdDialog, CDialog)
	//{{AFX_MSG_MAP(CWzdDialog)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWzdDialog message handlers

BOOL CWzdDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	SetTimer(
		1,				// event ID
		250,			// time in milliseconds
		NULL);			// causes a WM_TIMER message to be sent to this window
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CWzdDialog::OnButton1() 
{
	m_bFlashText=!m_bFlashText;
}

void CWzdDialog::OnButton2() 
{
	m_bFlashDlg=!m_bFlashDlg;
}

void CWzdDialog::OnTimer(UINT nIDEvent) 
{
	if (m_bFlashText)
	{
		static BOOL t=TRUE;
		m_ctrlStatic.ShowWindow((t=!t)?SW_SHOW:SW_HIDE);
	}

	if (m_bFlashDlg)
	{
		FlashWindow(TRUE);
	}

	CDialog::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

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