www.gusucode.com > VC++增强型“画图版”及图像处理程序源码程序 > VC++增强型“画图版”及图像处理程序源码程序\code\SMSetDlg.cpp

    // SMSetDlg.cpp : implementation file
// Download by http://www.NewXing.com
#include "stdafx.h"
#include "毕业设计.h"
#include "SMSetDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSMSetDlg dialog


CSMSetDlg::CSMSetDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSMSetDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSMSetDlg)
	m_bl = 15;
	m_bw = 50;
	//}}AFX_DATA_INIT
	dx = -1;
	dy = 1;
}


void CSMSetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSMSetDlg)
	DDX_Text(pDX, IDC_EDIT1, m_bl);
	DDX_Text(pDX, IDC_EDIT2, m_bw);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSMSetDlg, CDialog)
	//{{AFX_MSG_MAP(CSMSetDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSMSetDlg message handlers

void CSMSetDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	OnOK();
}

void CSMSetDlg::OnButton2() 
{
	// TODO: Add your control notification handler code here
	OnCancel();
}

void CSMSetDlg::OnOK(){
	if(UpdateData()){
		if(m_bl<0){
			m_bl = 0;
		}
		if(m_bl>15){
			m_bl=15;
		}
		if(m_bw<0){
			m_bw = 0;
		}
		if(m_bw>100){
			m_bw = 100;
		}
		CDialog::OnOK();
	}
}
void CSMSetDlg::OnCancel(){
	CDialog::OnCancel();
}

void CSMSetDlg::OnRadio1() 
{
	// TODO: Add your control notification handler code here
	dx = -1;
	dy = 1;
}

void CSMSetDlg::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	dx = 0;
	dy = 1;
}

void CSMSetDlg::OnRadio3() 
{
	// TODO: Add your control notification handler code here
	dx = 1;
	dy = 1;
}

void CSMSetDlg::OnRadio4() 
{
	// TODO: Add your control notification handler code here
	dx = 1;
	dy = 0;
}

BOOL CSMSetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CButton * bt = (CButton*)GetDlgItem(IDC_RADIO1);
	bt->SetCheck(TRUE);
	CWnd * w = GetDlgItem(IDC_EDIT1);
	w->SetFocus();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}