有时候我们需要这样一个控件,既具有下拉框的功能,又具有支持复选功能的树控件.
这有个例子:如果你想加入三个国家:"USA" (ID=5), "Canada" (ID=6), "UK" (ID=7), 他们之间有相应的关联,你需要使用下面的代码:
//## ADD tree items:
m_choCountries.AddString("North America");
m_choCountries.AddString("USA", 5, ROOT_LEVEL + 2);
m_choCountries.AddString("Canada", 6, ROOT_LEVEL + 2);
m_choCountries.AddString("Europe");
m_choCountries.AddString("UK", 7, ROOT_LEVEL + 2);
//## CHECK all items
m_choCountries.CheckAll(TRUE);
//## UNCHECK the item with ID = 6
m_choCountries.SetCheck(6, FALSE);
//## GET all checked items
CString strCheckedItems = m_choCountries.GetCheckedIDs();
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/