// VRDlg.cpp : implementation file // #include "stdafx.h" #include "dicomapp.h" #include "VRDlg.h" ///////////////////////////////////////////////////////////////////////////// // CDicomVRDlg dialog CDicomVRDlg::CDicomVRDlg(CWnd* pParent /*=NULL*/) : CDialog(CDicomVRDlg::IDD, pParent) { //{{AFX_DATA_INIT(CDicomVRDlg) //}}AFX_DATA_INIT m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CDicomVRDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDicomVRDlg) DDX_Control(pDX, IDC_INFO, m_Info); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDicomVRDlg, CDialog) //{{AFX_MSG_MAP(CDicomVRDlg) ON_LBN_SELCHANGE(IDC_INFO, OnSelchangeInfo) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDicomVRDlg message handlers BOOL CDicomVRDlg::OnInitDialog() { CDialog::OnInitDialog(); SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon pDICOMVR pVR; CString strText; int nItem; pVR = LDicomVR::GetFirst(); while (pVR != NULL) { strText.Format("%c%c\t%s", pVR->nCode >> 8, pVR->nCode & 0xFF, pVR->pszName); nItem = m_Info.AddString(strText); m_Info.SetItemData(nItem, (DWORD)pVR); pVR = LDicomVR::GetNext(pVR); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDicomVRDlg::OnSelchangeInfo() { int nItem; pDICOMVR pVR; CString strText; nItem = m_Info.GetCurSel(); if (nItem == LB_ERR) { return; } pVR = (pDICOMVR)m_Info.GetItemData(nItem); strText.Format("%c%c", pVR->nCode >> 8, pVR->nCode & 0xFF); SetDlgItemText(IDC_CODE, strText); SetDlgItemText(IDC_NAME, pVR->pszName); SetDlgItemInt(IDC_LENGTH, pVR->nLength); SetDlgItemInt(IDC_UNITSIZE, pVR->nUnitSize); switch (pVR->nRestrict & (~(VR_BINARY | VR_STRING | VR_TEXT))) { case VR_FIXED: strText = "Fixed length"; break; case VR_MAXIMUM: strText = "Maximum length"; break; case VR_MAXIMUM_GROUP: strText = "Maximum group length"; break; case VR_ANY: strText = "Any length"; break; case VR_NOT_APPLICABLE: strText = "Not applicable"; break; } SetDlgItemText(IDC_RESTRICT, strText); }