ParameterSettingDlg.cpp
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:4k
- // ParameterSettingDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "CartonRipple.h"
- #include "ParameterSettingDlg.h"
- #include "CartonRippleView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CParameterSettingDlg dialog
- CParameterSettingDlg::CParameterSettingDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CParameterSettingDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CParameterSettingDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CParameterSettingDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CParameterSettingDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CParameterSettingDlg, CDialog)
- //{{AFX_MSG_MAP(CParameterSettingDlg)
- ON_WM_HSCROLL()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CParameterSettingDlg message handlers
- void CParameterSettingDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
- {
- // TODO: Add your message handler code here and/or call default
- int ID=pScrollBar->GetDlgCtrlID();
- int value=((CSliderCtrl*)pScrollBar)->GetPos();
- int min,max;
- ((CSliderCtrl*)pScrollBar)->GetRange(min,max);
- switch(ID)
- {
- case IDC_DAMP_SLIDE:
- m_pView->m_myWater.m_density=value;
- break;
- case IDC_RAIN_DROP_SLIDE:
- m_pView->m_iRainFrequency=value;
- m_pView->ResetRainEffect();
- break;
- case IDC_CLICK_WAVE_RADIUS:
- m_pView->m_iMouseClickedRadius=value;
- break;
- case IDC_CLICK_WAVE_AMPLITUDE:
- m_pView->m_iMouseClickedHeight=value;
- break;
- case IDC_MOVE_WAVE_RADIUS:
- m_pView->m_iMouseMoveRadius=value;
- break;
- case IDC_MOVE_WAVE_AMPLITUDE:
- m_pView->m_iMouseMoveHeight=value;
- break;
- case IDC__AB_PROPORTION:
- m_pView->m_myWater.m_ABProportion=value/100.0;
- break;
- case IDC__REFRESH_FREQUENCY:
- m_pView->m_iRefreshFrequency=value;
- m_pView->ResetRefreshFrequency();
- break;
- }
- CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
- }
- BOOL CParameterSettingDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- //设置阻尼系数滑动条
- CSliderCtrl * slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_DAMP_SLIDE));
- slide->SetRange(1,10);
- slide->SetPos(5);
- //设置新生雨滴的降落时间间隔
- slide= static_cast<CSliderCtrl * >(GetDlgItem(IDC_RAIN_DROP_SLIDE));
- slide->SetRange(50,500);//
- slide->SetPos(100);
- //设置鼠标点击后生成的水波的半径
- slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_CLICK_WAVE_RADIUS));
- slide->SetRange(20,200);
- slide->SetPos(50);
- //设置鼠标点击后生成的水波的振幅
- slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_CLICK_WAVE_AMPLITUDE));
- slide->SetRange(50,600);
- slide->SetPos(100);
- //设置鼠标移动后生成的水波的半径
- slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_MOVE_WAVE_RADIUS));
- slide->SetRange(3,40);
- slide->SetPos(5);
- //设置鼠标移动后生成的水波的振幅
- slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC_MOVE_WAVE_AMPLITUDE));
- slide->SetRange(40,400);
- slide->SetPos(50);
- slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC__AB_PROPORTION));
- slide->SetRange(30,600);
- slide->SetPos(100);
- slide=static_cast<CSliderCtrl * >(GetDlgItem(IDC__REFRESH_FREQUENCY));
- slide->SetRange(10,100);
- slide->SetPos(30);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }