📄 setdlg.cpp
字号:
// SetDlg.cpp : implementation file
//
#include "stdafx.h"
#include "pictalk.h"
#include "SetDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetDlg dialog
CSetDlg::CSetDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSetDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetDlg)
m_Name = _T("");
m_nAge = 0;
m_Address = _T("");
m_IcqNum = 0;
m_IcqType = _T("");
m_Job = _T("");
m_Sex = _T("");
//}}AFX_DATA_INIT
}
void CSetDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetDlg)
DDX_Text(pDX, IDC_NAME, m_Name);
DDV_MaxChars(pDX, m_Name, 20);
DDX_Text(pDX, IDC_AGE, m_nAge);
DDV_MinMaxUInt(pDX, m_nAge, 0, 99);
DDX_Text(pDX, IDC_EDIT_ADDRESS, m_Address);
DDX_Text(pDX, IDC_ICQ_NUM, m_IcqNum);
DDX_CBString(pDX, IDC_ICQTYPE, m_IcqType);
DDX_Text(pDX, IDC_IJOB, m_Job);
DDX_CBString(pDX, IDC_SEX, m_Sex);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetDlg, CDialog)
//{{AFX_MSG_MAP(CSetDlg)
ON_BN_CLICKED(IDC_BUTTON_NEXT, OnButtonNext)
ON_BN_CLICKED(IDC_BUTTON_PRV, OnButtonPrv)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetDlg message handlers
void CSetDlg::OnButtonNext()
{
// TODO: Add your control notification handler code here
m_PicID++;
if(m_PicID>=MaxBody)
GetDlgItem(IDC_BUTTON_NEXT)->EnableWindow(FALSE);
if(m_PicID>0)
GetDlgItem(IDC_BUTTON_PRV)->EnableWindow(TRUE);
CClientDC ddc(this);
CRect rect(CPoint(20,40),CSize(46,78));
m_pbm->Draw(ddc,&rect,&CRect(0,m_PicID*78,46,m_PicID*78+78));
}
void CSetDlg::OnButtonPrv()
{
// TODO: Add your control notification handler code here
m_PicID--;
if(m_PicID<MaxBody)
GetDlgItem(IDC_BUTTON_NEXT)->EnableWindow(TRUE);
if(m_PicID<=0)
GetDlgItem(IDC_BUTTON_PRV)->EnableWindow(FALSE);
CClientDC ddc(this);
CRect rect(CPoint(20,40),CSize(46,78));
m_pbm->Draw(ddc,&rect,&CRect(0,m_PicID*78,46,m_PicID*78+78));
}
BOOL CSetDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_PicID=0;
GetDlgItem(IDC_BUTTON_PRV)->EnableWindow(FALSE);
((CComboBox *)GetDlgItem(IDC_SEX))->SetCurSel(0);
((CComboBox *)GetDlgItem(IDC_ICQTYPE))->SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSetDlg::SetBMP(CBmpProc *pbm)
{
m_pbm=pbm;
}
void CSetDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CClientDC ddc(this);
CRect rect(CPoint(20,40),CSize(54,78));
m_pbm->Draw(ddc,&rect,&CRect(0,m_PicID*78,54,m_PicID*78+78));
// Do not call CDialog::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -