tree

作者: fffwc | 来源:发表于2020-10-13 11:50 被阅读0次

HICON icon[4];

icon[0] = AfxGetApp()->LoadIconW(IDI_ICON1);

icon[1] = AfxGetApp()->LoadIconW(IDI_ICON2);

icon[2] = AfxGetApp()->LoadIconW(IDI_ICON3);

icon[3] = AfxGetApp()->LoadIconW(IDI_ICON4);

m_imageList.Create(30, 30, ILC_COLOR32, 3, 3);

for (int i = 0; i < 4;i++)

{

m_imageList.Add(icon[i]);

}

m_tree.SetImageList(&m_imageList, LVSIL_NORMAL);

HTREEITEM root = m_tree.InsertItem(TEXT("feng"), 0, 0, NULL);

HTREEITEM root1 = m_tree.InsertItem(TEXT("wei"), 0, 0, NULL);

HTREEITEM father = m_tree.InsertItem(TEXT("ccc"), 1, 1, root);

HTREEITEM son = m_tree.InsertItem(TEXT("eee"), 2, 2, father);

HTREEITEM father1 = m_tree.InsertItem(TEXT("ddd"), 1, 1, root1);

HTREEITEM son1 = m_tree.InsertItem(TEXT("fff"), 2, 2, father1);

HTREEITEM grandson = m_tree.InsertItem(TEXT("fff"), 3, 3, son1);

m_tree.SelectItem(father);

m_tree.SelectItem(grandson);

相关文章

网友评论

      本文标题:tree

      本文链接:https://www.haomeiwen.com/subject/kwhvpktx.html