// MenuImageMeasure_Dlg.cpp : 实现文件
//

#include "stdafx.h"
#include "CombineSubjectDrawTest.h"
#include "MenuImageMeasure_Dlg.h"
#include "afxdialogex.h"


// CMenuImageMeasure_Dlg 对话框

IMPLEMENT_DYNAMIC(CMenuImageMeasure_Dlg, CDialogEx)

CMenuImageMeasure_Dlg::CMenuImageMeasure_Dlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(IDD_DIALOG_MEASURE, pParent)
	, m_nWidth(0)
{
	m_pControl = NULL;
}

CMenuImageMeasure_Dlg::~CMenuImageMeasure_Dlg()
{
}

void CMenuImageMeasure_Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_MFCCOLORBUTTON_COLOR, m_color_btn);
	DDX_Text(pDX, IDC_EDIT_WIDTH, m_nWidth);
}


BEGIN_MESSAGE_MAP(CMenuImageMeasure_Dlg, CDialogEx)
	ON_BN_CLICKED(IDC_CHECK_ENABLE, &CMenuImageMeasure_Dlg::OnBnClickedCheckEnable)
	ON_BN_CLICKED(IDC_BUTTON_WIDTH, &CMenuImageMeasure_Dlg::OnBnClickedButtonWidth)
	ON_BN_CLICKED(IDC_MFCCOLORBUTTON_COLOR, &CMenuImageMeasure_Dlg::OnBnClickedMfccolorbuttonColor)
END_MESSAGE_MAP()


// CMenuImageMeasure_Dlg 消息处理程序


void CMenuImageMeasure_Dlg::OnBnClickedCheckEnable()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* pBtn = (CButton*)GetDlgItem(IDC_CHECK_ENABLE);
	m_pControl->SetMeasureModeStatus(pBtn->GetCheck());
}


void CMenuImageMeasure_Dlg::OnBnClickedButtonWidth()
{
	// TODO: 在此添加控件通知处理程序代码
	if (FALSE == UpdateData(TRUE))
		return;

	m_pControl->SetMeasureLineWidth(m_nWidth);

}


BOOL CMenuImageMeasure_Dlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	
	m_pControl->GetMeasureLineWidth(m_nWidth);
	COLORREF _color;
	m_pControl->GetMeasureLineColor(_color);

	CButton* pBtn = (CButton*)GetDlgItem(IDC_CHECK_ENABLE);
	pBtn->SetCheck(m_pControl->GetMeasureModeStatus());
	m_color_btn.SetColor(_color);

	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}


void CMenuImageMeasure_Dlg::OnBnClickedMfccolorbuttonColor()
{
	m_pControl->SetMeasureLineColor(m_color_btn.GetColor());
}
