文件名称:mfc经典案例
文件大小:43.59MB
文件格式:ZIP
更新时间:2019-01-12 16:50:46
mfc
void CLeftView::OnInitialUpdate() { CTreeView::OnInitialUpdate(); CRuntimeClass *prc =RUNTIME_CLASS(CLeftView); BOOL b = prc ->IsDerivedFrom(RUNTIME_CLASS(CDC)); b = this ->IsKindOf(RUNTIME_CLASS(CDC)); static int i = 0; if (i)return; ++i; ModifyStyle(0,TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS | TVS_HASLINES); m_ilist.Create(16,16,ILC_COLOR32,4,4); m_ilist.Add(AfxGetApp()->LoadIcon(IDI_ICON1)); m_ilist.Add(AfxGetApp()->LoadIcon(IDI_ICON2)); m_ilist.Add(AfxGetApp()->LoadIcon(IDI_FILE)); m_Tree.SetImageList(&m_ilist,TVSIL_NORMAL); m_hItem = m_Tree.InsertItem("我的电脑",0); DWORD dwDrives; char a; CString DriveName; dwDrives = GetLogicalDrives(); a = 'A'; while (dwDrives > 0) { if (dwDrives % 2 == 1) { DriveName.Format("%c:", a); m_Tree.InsertItem(DriveName, 1, 1, m_hItem); } a++; dwDrives /= 2; } m_Tree.Expand(m_hItem,TVE_EXPAND); }