// step1Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "step1.h"
#include "step1Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStep1Dlg dialog
CStep1Dlg::CStep1Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CStep1Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStep1Dlg)
m_edit = _T("");
m_chk1 = FALSE;
m_chk2 = FALSE;
m_chk3 = FALSE;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CStep1Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStep1Dlg)
DDX_Control(pDX, IDC_COMBO1, m_combo1);
DDX_Control(pDX, IDC_RADIO2, m_radfemale);
DDX_Control(pDX, IDC_RADIO1, m_radmale);
DDX_Text(pDX, IDC_EDIT1, m_edit);
DDV_MaxChars(pDX, m_edit, 4);
DDX_Check(pDX, IDC_CHECK1, m_chk1);
DDX_Check(pDX, IDC_CHECK2, m_chk2);
DDX_Check(pDX, IDC_CHECK3, m_chk3);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStep1Dlg, CDialog)
//{{AFX_MSG_MAP(CStep1Dlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_EN_MAXTEXT(IDC_EDIT1, OnMaxtextEdit1)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStep1Dlg message handlers
BOOL CStep1Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
//m_edit.SetWindowText("welcome");
//m_edit.EnableWindow(false);
m_edit="123";
UpdateData(false);
m_combo1.AddString( "23");
m_combo1.InsertString(4, "24" );
m_combo1.SetCurSel(4);
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CStep1Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CStep1Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CStep1Dlg::OnMaxtextEdit1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
AfxMessageBox(m_edit);
}
void CStep1Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString str;
if(m_radmale.GetCheck())
m_radmale.GetWindowText(str);
else
m_radfemale.GetWindowText(str);
UpdateData(true);
if(m_chk1) str+="、 游泳" ;
if(m_chk2) str+="、 跑步" ;
if(m_chk3) str+="、 打球" ;
MessageBox(str,"测试",MB_OKCANCEL);
}
void CStep1Dlg::OnRadio1()
{
m_radmale.SetCheck(true);
m_radfemale.SetCheck(false);
}
void CStep1Dlg::OnRadio2()
{
// TODO: Add your control notification handler code here
m_radmale.SetCheck(false);
m_radfemale.SetCheck(true);
}