wakeupdlg.cpp

来自「一个比较详细的操作系统进程同步模拟的例子」· C++ 代码 · 共 110 行

CPP
110
字号
// WakeUpDlg.cpp : implementation file
//

#include "stdafx.h"
#include "process.h"
#include "WakeUpDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CWakeUpDlg dialog


CWakeUpDlg::CWakeUpDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CWakeUpDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CWakeUpDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	radio1 = false;
	radio2 = false;
	radio3 = false;
}


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


BEGIN_MESSAGE_MAP(CWakeUpDlg, CDialog)
	//{{AFX_MSG_MAP(CWakeUpDlg)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	ON_WM_ERASEBKGND()
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWakeUpDlg message handlers

void CWakeUpDlg::OnRadio1() 
{
	// TODO: Add your control notification handler code here
	radio1 = true;
	radio2 = false;
	radio3 = false;

}

void CWakeUpDlg::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	radio1 = false;
	radio2 = true;
	radio3 = false;
}


void CWakeUpDlg::OnRadio3() 
{
	// TODO: Add your control notification handler code here
	radio1 = false;
	radio2 = false;
	radio3 = true;
}

BOOL CWakeUpDlg::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	CRect rcClient;
    CBrush m_brBkgnd;
    m_brBkgnd.CreateSolidBrush(RGB(66,96,76));//设置对话框背景颜色

    GetClientRect(&rcClient);

    pDC->FillRect(&rcClient,&m_brBkgnd);

    return TRUE;

	return CDialog::OnEraseBkgnd(pDC);
}

HBRUSH CWakeUpDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	COLORREF   clr   =   RGB(55,30,60);     
    pDC->SetTextColor(clr);       //设置红色的文本     
    clr   =   RGB(66,96,76);     
    pDC->SetBkColor(clr);           //设置背景     
    HBRUSH m_brMine   =   ::CreateSolidBrush(clr);     
    
    return   m_brMine;  

	// TODO: Return a different brush if the default is not desired
	//return hbr;
}

⌨️ 快捷键说明

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