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

📄 scaledlg.cpp

📁 本光盘包含了《精通Visual C++图像处理编程(第3版)》一书中全部的源代码、示例程序的可执行文件以及一些供图像处理测试用的图像文件。
💻 CPP
字号:
// ScaleDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TransformShow.h"
#include "ScaleDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CScaleDlg dialog


CScaleDlg::CScaleDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CScaleDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CScaleDlg)
	m_strXRatio = _T("1.0");
	m_strYRatio = _T("1.0");
	m_bProportionXY = TRUE;
	//}}AFX_DATA_INIT
	m_fRatioX = 1.0;
	m_fRatioY = 1.0;
}


void CScaleDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CScaleDlg)
	DDX_Text(pDX, IDC_EDIT1, m_strXRatio);
	DDX_Check(pDX, IDC_CHECK1, m_bProportionXY);
	DDX_Text(pDX, IDC_EDIT2, m_strYRatio);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CScaleDlg, CDialog)
	//{{AFX_MSG_MAP(CScaleDlg)
	ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
	ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
	ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CScaleDlg message handlers

void CScaleDlg::OnCheck1() 
{
	UpdateData();
	if (m_bProportionXY)
	{
		m_strYRatio = m_strXRatio;
		UpdateData(FALSE);
	}
}

void CScaleDlg::OnChangeEdit1() 
{
	// 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.
	
	UpdateData();
	if (m_bProportionXY)
	{
		m_strYRatio = m_strXRatio;
		UpdateData(FALSE);
	}
}

void CScaleDlg::OnChangeEdit2() 
{
	// 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.
	
	UpdateData();
	if (m_bProportionXY)
	{
		m_strXRatio = m_strYRatio;
		UpdateData(FALSE);
	}
}

BOOL CScaleDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	UpdateData(FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CScaleDlg::OnOK() 
{
	UpdateData();
	m_fRatioX = atof(m_strXRatio);
	m_fRatioY = atof(m_strYRatio);
	
	CDialog::OnOK();
}

⌨️ 快捷键说明

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