StreamDown中的CTreeCtrl控件处理代码

 this->m_MyFont.CreateFont(12,0, 0, 0, FW_NORMAL, FALSE, FALSE, 0, GB2312_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,DEFAULT_PITCH   |   FF_SWISS,_T("Arial"));
       
CImageList m_ImagesList;
m_ImagesList.Create(16,16,ILC_COLOR24,0,8);
CBitmap bmp;
bmp.LoadBitmap(IDB_LEFT);
m_ImagesList.Add(&bmp, RGB(0,0,0));


HTREEITEM root0=theTree.InsertItem("",0,1,TVI_ROOT,TVI_LAST);
HTREEITEM root=theTree.InsertItem("StreamDown",3,3,TVI_ROOT,TVI_LAST);

theTree.InsertItem("Downloading",3,3,root,TVI_LAST);
theTree.InsertItem("Downloaded",4,4,root,TVI_LAST);
theTree.InsertItem("Deleted",5,5,root,TVI_LAST);
theTree.Expand(root,TVE_EXPAND);//此根节点默认展开

//theTree.SetBkColor(RGB(255,0,0));
theTree.SetImageList(&m_ImagesList,TVSIL_NORMAL);

响应=TVN_SELCHANGED消息
OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
 NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
 // TODO: Add your control notification handler code here 
 CTreeCtrl& theTree = GetTreeCtrl(); 
 CString strCation = theTree.GetItemText(pNMTreeView->itemNew.hItem);
 strCation.MakeLower();
 int nIndex;
 if (strCation == "downloaded")
 {
  nIndex = 1;
 }
 else if(strCation == "deleted")
 {
  nIndex = 2;
 }
 else
 {
  nIndex = 0;
 }
 CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
 pMainFrame->TreeSelectItemChanged(nIndex); 
 *pResult = 0;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值