MfcSaverDlg.cpp
上传用户:szxyd1688
上传日期:2007-06-08
资源大小:1440k
文件大小:2k
- // MfcSaverDlg.cpp : implementation file
- //
- #include "StdAfx.h"
- #include "MfcSaver.h"
- #include "MfcSaverDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- BEGIN_MESSAGE_MAP(CMfcSaverDlg, CB14Dlg)
- //{{AFX_MSG_MAP(CMfcSaverDlg)
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- CMfcSaverDlg::CMfcSaverDlg()
- {
- //{{AFX_DATA_INIT(CMfcSaverDlg)
- //}}AFX_DATA_INIT
- }
- BOOL CMfcSaverDlg::OnInitDialog()
- {
- CB14Dlg::OnInitDialog();
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // As with most MFC dialog boxes, the DoDataExchange() is where all the work
- // happens. There's no easy DDX_Trackbar thing to set up the control, so
- // we do it ourselves. See how the SaveOptions() and RestoreOptions() are
- // called on the CMfcSaver to keep those options persistent.
- //
- void CMfcSaverDlg::DoDataExchange(CDataExchange* pDX)
- {
- CB14Dlg::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMfcSaverDlg)
- //}}AFX_DATA_MAP
- CMfcSaver* pSaver = (CMfcSaver*)AfxGetScreenSaverWnd();
- if (!pSaver)
- return;
- CSliderCtrl* pSlider;
- if (!pDX->m_bSaveAndValidate)
- {
- pSaver->RestoreOptions();
- pSlider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
- pSlider->SetRange(1, 50);
- pSlider->SetPos(pSaver->GetIconCount());
- pSlider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER2);
- pSlider->SetRange(1, 50);
- pSlider->SetPos(pSaver->GetIconSpeed());
- }
- else
- {
- pSlider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1);
- pSaver->SetIconCount(pSlider->GetPos());
- pSlider = (CSliderCtrl*)GetDlgItem(IDC_SLIDER2);
- pSaver->SetIconSpeed(pSlider->GetPos());
- pSaver->SaveOptions();
- }
- }