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

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


// CControlSelect_Dlg 对话框

IMPLEMENT_DYNAMIC(CControlSelect_Dlg, CDialogEx)

CControlSelect_Dlg::CControlSelect_Dlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(IDD_DIALOG_CONTROL, pParent)
{
	m_nTotalControl = 0;
	m_nSelControl = -1;
}

CControlSelect_Dlg::~CControlSelect_Dlg()
{
}

void CControlSelect_Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COMBO_CONTROL, m_control_cbx);
}


BEGIN_MESSAGE_MAP(CControlSelect_Dlg, CDialogEx)
	ON_BN_CLICKED(IDOK, &CControlSelect_Dlg::OnBnClickedOk)
END_MESSAGE_MAP()


// CControlSelect_Dlg 消息处理程序


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

	CString strInfo;

	for (int i = 0; i < m_nTotalControl; i++)
	{
		strInfo.Format(_T("控件序号:%d"), i);
		int nIdx = m_control_cbx.AddString(strInfo);
		m_control_cbx.SetItemData(nIdx, (DWORD_PTR)i);
	}

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


void CControlSelect_Dlg::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	int nSel = m_control_cbx.GetCurSel();

	if (nSel < 0)
	{
		MessageBox(_T("请选择要操作的控件"), _T("提示"), MB_ICONINFORMATION);
		return;
	}

	m_nSelControl = m_control_cbx.GetItemData(nSel);
	
	CDialogEx::OnOK();
}
