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

📄 sportdlg.cpp

📁 一个控制字符移动的MFC程序
💻 CPP
字号:
// SportDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Timer.h"
#include "SportDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSportDlg dialog


CSportDlg::CSportDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSportDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSportDlg)
	m_h = 0;
	m_w = 0;
	m_distance = 0;
	m_speed = 0;
	m_s = 0;
	//}}AFX_DATA_INIT
}


void CSportDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSportDlg)
	DDX_Control(pDX, IDC_SLIDER1, m_slider);
	DDX_Text(pDX, IDC_EDIT1, m_h);
	DDX_Text(pDX, IDC_EDIT2, m_w);
	DDX_Text(pDX, IDC_EDIT3, m_distance);
	DDV_MinMaxInt(pDX, m_distance, 1, 200);
	DDX_Slider(pDX, IDC_SLIDER1, m_speed);
	DDX_Text(pDX, IDC_EDIT4, m_s);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSportDlg, CDialog)
	//{{AFX_MSG_MAP(CSportDlg)
	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER1, OnCustomdrawSlider1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSportDlg message handlers

void CSportDlg::OnOK() 
{
	// TODO: Add extra validation here
	
	CDialog::OnOK();
}

void CSportDlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

BOOL CSportDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_slider.SetRange(10,200);
	m_slider.SetTicFreq(100);
	m_slider.SetPos(100);
	UpdateData(false);
	return true;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


void CSportDlg::OnCustomdrawSlider1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
	m_s=m_slider.GetPos();
	UpdateData(false);
	*pResult = 0;
}

⌨️ 快捷键说明

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