DlgAddNoise.cpp
上传用户:alisonmail
上传日期:2013-02-28
资源大小:500k
文件大小:2k
- // DlgAddNoise.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ImageView.h"
- #include "DlgAddNoise.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgAddNoise dialog
- CDlgAddNoise::CDlgAddNoise(CWnd* pParent /*=NULL*/)
- : CDialog(CDlgAddNoise::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDlgAddNoise)
- m_nNoiseRatio = 10;
- //}}AFX_DATA_INIT
- }
- void CDlgAddNoise::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgAddNoise)
- DDX_Control(pDX, IDC_SLIDER_RATIO, m_slider);
- DDX_Text(pDX, IDC_EDIT_RATIO, m_nNoiseRatio);
- DDV_MinMaxInt(pDX, m_nNoiseRatio, 0, 100);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDlgAddNoise, CDialog)
- //{{AFX_MSG_MAP(CDlgAddNoise)
- ON_WM_HSCROLL()
- ON_EN_CHANGE(IDC_EDIT_RATIO, OnChangeEdit)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgAddNoise message handlers
- BOOL CDlgAddNoise::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- m_slider.SetRange(0, 100, TRUE);
- m_slider.SetTicFreq(10);
- m_slider.SetLineSize(1);
- m_slider.SetPageSize(10);
- m_slider.SetPos(10);
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CDlgAddNoise::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
- {
- m_nNoiseRatio = m_slider.GetPos();
- UpdateData(FALSE);
-
- CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
- }
- void CDlgAddNoise::OnChangeEdit()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CDialog::OnInitDialog()
- // function to send the EM_SETEVENTMASK message to the control
- // with the ENM_CHANGE flag ORed into the lParam mask.
-
- // TODO: Add your control notification handler code here
- UpdateData(TRUE);
- m_slider.SetPos(m_nNoiseRatio);
- }