#include "stdafx.h" #include "resource.h" #include "KTComponentsDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif KTComponentsDlg::KTComponentsDlg(CWnd* pParent) : CDialog(KTComponentsDlg::IDD, pParent) { //{{AFX_DATA_INIT(KTComponentsDlg) //}}AFX_DATA_INIT m_iCurType = -1; } void KTComponentsDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(KTComponentsDlg) DDX_Control(pDX, IDC_PIC_SAMPLE, m_wndPicSample); DDX_Control(pDX, IDC_LST_COMPONENTS, m_wndLstComponents); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(KTComponentsDlg, CDialog) //{{AFX_MSG_MAP(KTComponentsDlg) ON_LBN_SELCHANGE(IDC_LST_COMPONENTS, OnSelchangeLstComponents) ON_LBN_DBLCLK(IDC_LST_COMPONENTS, OnDblclkLstComponents) //}}AFX_MSG_MAP END_MESSAGE_MAP() BOOL KTComponentsDlg::OnInitDialog() { CDialog::OnInitDialog(); m_wndLstComponents.AddString(_T("Generic")); m_wndLstComponents.AddString(_T("Cylinder")); m_wndLstComponents.AddString(_T("Concentric")); m_wndLstComponents.AddString(_T("Ecccentric")); m_wndLstComponents.AddString(_T("Skirt")); m_wndLstComponents.AddString(_T("Hemispherical Head")); m_wndLstComponents.AddString(_T("Elliptical Head")); m_wndLstComponents.AddString(_T("Dished Head")); m_wndLstComponents.SetCurSel(0); OnSelchangeLstComponents(); return TRUE; } void KTComponentsDlg::OnSelchangeLstComponents() { m_iCurType = m_wndLstComponents.GetCurSel(); if (m_iCurType < 0) return; const UINT ID[] = {IDB_COM_GENERIC, IDB_COM_CYLINDER, IDB_COM_CONCENTRIC, IDB_COM_ECCCENTRIC, IDB_COM_SKIRT, IDB_COM_HEMIHEAD, IDB_COM_ELLIHEAD, IDB_COM_DISHHEAD}; m_bmpSample.DeleteObject(); m_bmpSample.LoadBitmap(ID[m_iCurType]); m_wndPicSample.SetBitmap(m_bmpSample); } void KTComponentsDlg::OnDblclkLstComponents() { CDialog::OnOK(); }