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

📄 spinner.cpp

📁 The project demonstrates many Windows common controls, including the extensive use of image lists. T
💻 CPP
字号:
// spinner.cpp : implementation file
//

#include "stdafx.h"
#include "DooDads.h"
#include "spinner.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSpinnerDialog dialog


CSpinnerDialog::CSpinnerDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CSpinnerDialog::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSpinnerDialog)
	m_nMonth = 1;
	m_nScore = 87;
	m_nYear = 1970;
	//}}AFX_DATA_INIT
}


void CSpinnerDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSpinnerDialog)
	DDX_Text(pDX, IDC_MONTH, m_nMonth);
	DDV_MinMaxInt(pDX, m_nMonth, 1, 12);
	DDX_Text(pDX, IDC_SCORE, m_nScore);
	DDV_MinMaxInt(pDX, m_nScore, 0, 100);
	DDX_Text(pDX, IDC_YEAR, m_nYear);
	DDV_MinMaxInt(pDX, m_nYear, 1900, 2155);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSpinnerDialog, CDialog)
	//{{AFX_MSG_MAP(CSpinnerDialog)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CSpinnerDialog message handlers

static UDACCEL aAccelerationTable[] ={
	{ 2, 100},			// immediately use 100's
	{ 5, 500},			// 500's after 5 seconds
	{10, 1000},			// 1000's after 10 seconds
};

BOOL CSpinnerDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();

	CSpinButtonCtrl* pBalance;
	pBalance = (CSpinButtonCtrl*) GetDlgItem(IDC_BALANCESPIN);
	ASSERT(pBalance != NULL);

	pBalance->SetRange(0, UD_MAXVAL-1);

	pBalance->SetAccel(3, aAccelerationTable);

	CSpinButtonCtrl* pYear;
	pYear = (CSpinButtonCtrl*) GetDlgItem(IDC_YEARSPIN);
	ASSERT(pYear != NULL);

	pYear->SetRange(1900, 2155);

	CSpinButtonCtrl* pMonth;
	pMonth = (CSpinButtonCtrl*) GetDlgItem(IDC_MONTHSPIN);
	ASSERT(pMonth != NULL);

	pMonth->SetRange(1, 12);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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