CSpinButtonCtrl* pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_SPIN);
pSpin->SetRange(0, 999);
---
CFileDialog dlg(TRUE, _T("txt"));
dlg.m_ofn.lpstrFilter = _T("Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0");
dlg.m_ofn.lpstrInitialDir = _T("E:\\");
dlg.m_ofn.lpstrTitle = _T("打开某某文件");
---
CFileDialog dlg(FALSE, _T("txt"));
dlg.m_ofn.lpstrFilter = _T("Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0");
dlg.m_ofn.lpstrInitialDir = _T("E:\\");
dlg.m_ofn.lpstrTitle = _T("某某文件保存在");
---
对话框缩略图部分展开隐藏的实现(详见孙鑫视频第七讲)。
CXTEditListBox的操作,CXTEditListBox与CList的结合。
CComboBox的操作:实现defencepage里两个combobox之间从属关系的消息响应控制。
---
void CMissileDialogDlg::ImageInitial()
{
CWnd* pWnd = GetDlgItem(IDC_IMAGE);
pWnd->Invalidate();
pWnd->UpdateWindow();
pWnd->GetClientRect(m_imageRect);
pWnd->ClientToScreen(&m_imageRect);
CRect rect;
GetClientRect(rect);
ClientToScreen(&rect);
m_imageRect.top -= rect.top;
m_imageRect.left -= rect.left;
pWnd->MoveWindow(m_imageRect.left, m_imageRect.top, 200, 200);
m_imageRect.bottom = m_imageRect.top + 200;
m_imageRect.right = m_imageRect.left + 200;
CFile file;
file.Open("F:\\YU\\HILL.bmp", CFile::modeRead | CFile::shareDenyWrite);
m_hDIB = ::ReadDIBFile(file);
CDC *pDC;
pDC = pWnd->GetDC();
HDIB hDIB = m_hDIB;
LPSTR lpDIB = (LPSTR) ::GlobalLock((HGLOBAL) hDIB);
int cxDIB = (int) ::DIBWidth(lpDIB); // Size of DIB - x
int cyDIB = (int) ::DIBHeight(lpDIB); // Size of DIB - y
::GlobalUnlock((HGLOBAL) hDIB);
m_palDIB = new CPalette;
::CreateDIBPalette(m_hDIB, m_palDIB);
CRect rcDIB;
rcDIB.top = rcDIB.left = 0;
rcDIB.right = cxDIB;
rcDIB.bottom = cyDIB;
CRect rcDest;
rcDest.top = rcDest.left = 0;
rcDest.right = rcDest.bottom = 200;
::PaintDIB(pDC->m_hDC, &rcDest, hDIB,
&rcDIB, m_palDIB);
pWnd->ReleaseDC(pDC);
}
---
CTreeCtrl的新建、插入、删除,以及和CList的关联操作(defencepage类中)。