列表框控件
// 为组合框控件的列表框添加列表项“百度”
m_comboWeb.AddString(_T( "百度" ));
// 在组合框控件的列表框中索引为1的位置插入列表项“新浪”
m_comboWeb.InsertString(1, _T( "新浪" ));
// 默认选择第一项
m_comboWeb.SetCurSel(0); //列表中从上向下,索引依次为0,1,2,3,.....
// 编辑框中默认显示第一项的文字
SetDlgItemText(IDC_EDIT1,_T("diyi"));
int nSel;
// 获取组合框控件的列表框中选中项的索引
nSel = m_comboWeb.GetCurSel();
// 根据选中项索引获取该项字符串
m_comboWeb.GetLBText(nSel, strWeb);
// 将组合框中选中的字符串显示到IDC_SEL_WEB_EDIT编辑框中
SetDlgItemText(IDC_SEL_WEB_EDIT, strWeb);
}
// 为组合框控件的列表框添加列表项“百度”
m_comboWeb.AddString(_T( "百度" ));
// 在组合框控件的列表框中索引为1的位置插入列表项“新浪”
m_comboWeb.InsertString(1, _T( "新浪" ));
// 默认选择第一项
m_comboWeb.SetCurSel(0); //列表中从上向下,索引依次为0,1,2,3,.....
SetDlgItemText(IDC_EDIT1,_T("diyi"));
int nSel;
// 获取组合框控件的列表框中选中项的索引
nSel = m_comboWeb.GetCurSel();
// 根据选中项索引获取该项字符串
m_comboWeb.GetLBText(nSel, strWeb);
// 将组合框中选中的字符串显示到IDC_SEL_WEB_EDIT编辑框中
SetDlgItemText(IDC_SEL_WEB_EDIT, strWeb);
}