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

📄 initset.cpp

📁 这是一个俄罗斯方块的源代码
💻 CPP
字号:
// INITSET.cpp : implementation file
//

#include "stdafx.h"
#include "俄罗斯方块.h"
#include "INITSET.h"

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

/////////////////////////////////////////////////////////////////////////////
// INITSET dialog


INITSET::INITSET(CWnd* pParent /*=NULL*/)
	: CDialog(INITSET::IDD, pParent)
{
	//{{AFX_DATA_INIT(INITSET)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	level=1;
	floor=0;
	Wav=TRUE;
	TempWav=TRUE;
}


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


BEGIN_MESSAGE_MAP(INITSET, CDialog)
	//{{AFX_MSG_MAP(INITSET)
	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER1, OnCustomdrawSlider1)
	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER2, OnCustomdrawSlider2)
	ON_BN_CLICKED(IDC_CHECK, OnCheck)
	ON_BN_CLICKED(IDC_QUICKDROP, OnQuickdrop)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// INITSET message handlers

BOOL INITSET::OnInitDialog() 
{
	CDialog::OnInitDialog();
	Slider1.SubclassDlgItem(IDC_SLIDER1,this);
	Slider2.SubclassDlgItem(IDC_SLIDER2,this);
	Slider1.SetRange(0,12);
	Slider1.SetLineSize(1);
	Slider1.SetPos(floor);
	Slider2.SetRange(1,8);
	Slider2.SetLineSize(1);
	Slider2.SetPos(level);
	edit1.SubclassDlgItem(IDC_EDIT1,this);
	edit2.SubclassDlgItem(IDC_EDIT2,this);
	edit1.SetWindowText("0");
	edit2.SetWindowText("0");
	TempWav=Wav;
	if (Wav)
		INITSET::CheckDlgButton(IDC_CHECK,MF_CHECKED);
	else
	    INITSET::CheckDlgButton(IDC_CHECK,MF_UNCHECKED);
    TempQuickDrop=QuickDrop; 
	if (QuickDrop)
		INITSET::CheckDlgButton(IDC_QUICKDROP,MF_CHECKED);
	else
	    INITSET::CheckDlgButton(IDC_QUICKDROP,MF_UNCHECKED);
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void INITSET::OnOK() 
{
	// TODO: Add extra validation here
	INITSET::floor=Slider1.GetPos();
	INITSET::level=Slider2.GetPos();
	Wav=TempWav;
    QuickDrop=TempQuickDrop;
	CDialog::OnOK();
}

void INITSET::OnCustomdrawSlider1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	char temp[5]="";
	sprintf(temp,"%d",Slider1.GetPos());
	edit1.SetWindowText(temp);
	*pResult = 0;
}

void INITSET::OnCustomdrawSlider2(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	char temp[5]="";
	sprintf(temp,"%d",Slider2.GetPos());
	edit2.SetWindowText(temp);
	*pResult = 0;
}


void INITSET::OnCheck() 
{
	// TODO: Add your control notification handler code here
	TempWav=1-TempWav;
}

void INITSET::OnQuickdrop() 
{
	// TODO: Add your control notification handler code here
	TempQuickDrop=1-TempQuickDrop;
}

⌨️ 快捷键说明

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