// CControlJobDlg.cpp: 实现文件 // #include "stdafx.h" #include "Servo.h" #include "CControlJobDlg.h" #include "afxdialogex.h" // CControlJobDlg 对话框 IMPLEMENT_DYNAMIC(CControlJobDlg, CDialogEx) CControlJobDlg::CControlJobDlg(CWnd* pParent /*=nullptr*/) : CDialogEx(IDD_DIALOG_CONTROL_JOB, pParent) { } CControlJobDlg::~CControlJobDlg() { } void CControlJobDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, IDC_LIST1, m_listCtrl); } BEGIN_MESSAGE_MAP(CControlJobDlg, CDialogEx) END_MESSAGE_MAP() // CControlJobDlg 消息处理程序 BOOL CControlJobDlg::OnInitDialog() { CDialogEx::OnInitDialog(); DWORD dwStyle = m_listCtrl.GetExtendedStyle(); dwStyle |= LVS_EX_FULLROWSELECT; dwStyle |= LVS_EX_GRIDLINES; m_listCtrl.SetExtendedStyle(dwStyle); HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1); ListView_SetImageList(m_listCtrl.GetSafeHwnd(), imageList, LVSIL_SMALL); // m_list 已经是对话框上的 CExpandableListCtrl 成员(拖控件改类) m_listCtrl.ModifyStyle(0, LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS); m_listCtrl.InsertColumn(0, _T("名称"), LVCFMT_LEFT, 260); m_listCtrl.InsertColumn(1, _T("状态"), LVCFMT_LEFT, 120); m_listCtrl.InsertColumn(2, _T("描述"), LVCFMT_LEFT, 260); auto* root1 = m_listCtrl.InsertRoot({ _T("EFEM"), _T("Ready"), _T("Front End Module") }); m_listCtrl.InsertChild(root1, { _T("Slot #1"), _T("OK"), _T("150mm wafer") }); m_listCtrl.InsertChild(root1, { _T("Slot #2"), _T("Empty"), _T("") }); auto* root2 = m_listCtrl.InsertRoot({ _T("Bonder"), _T("Run"), _T("G1+G2 Process") }); auto* ch21 = m_listCtrl.InsertChild(root2, { _T("Job A"), _T("Proc"), _T("Step 1") }); m_listCtrl.InsertChild(ch21, { _T("SubStep A1"), _T("Done"), _T("Align") }); m_listCtrl.InsertChild(ch21, { _T("SubStep A2"), _T("Run"), _T("Bond") }); // 初始让顶层展开 //root1->expanded = true; //root2->expanded = true; m_listCtrl.RebuildVisible(); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }