threshdlg.cpp

来自「用内存设备上下文实现图像选中区域 的判断」· C++ 代码 · 共 77 行

CPP
77
字号
// ThreshDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ImageProc.h"
#include "ThreshDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CThreshDlg dialog


CThreshDlg::CThreshDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CThreshDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CThreshDlg)
	m_pView=NULL;
	m_threshold = 0;
	//}}AFX_DATA_INIT
}


void CThreshDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CThreshDlg)
	DDX_Control(pDX, IDC_SPIN, m_threshCtr);
	DDX_Control(pDX, IDC_EDIT_THRESHOLD, m_threshEdit);
	DDX_Text(pDX, IDC_THRESH_VALUE, m_threshold);
	DDV_MinMaxInt(pDX, m_threshold, 0, 255);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CThreshDlg, CDialog)
	//{{AFX_MSG_MAP(CThreshDlg)
	ON_EN_CHANGE(IDC_EDIT_THRESHOLD, OnChangeEditThreshold)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CThreshDlg message handlers



void CThreshDlg::OnChangeEditThreshold() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	if(m_pView!=NULL)
	{
		this->UpdateData(TRUE);
		m_pView->m_thresh=m_threshCtr.GetPos();
		m_pView->PostMessage(WM_THRESHCHANGED);
	}
}


BOOL CThreshDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_threshCtr.SetBuddy(&m_threshEdit);
	m_threshCtr.SetRange(0,255);
	m_threshCtr.SetPos(m_pView->m_thresh);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?