⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threshdlg.cpp

📁 用内存设备上下文实现图像选中区域 的判断
💻 CPP
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -