打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
列表框ListBox-3
userphoto

2017.02.25

关注

 
 
BOOL CLISTBOX3Dlg::OnInitDialog()
{
m_ListBox1.AddString("张三");
m_ListBox1.AddString("李四");
m_ListBox1.AddString("王五");
m_ListBox1.AddString("赵六");
m_ListBox1.AddString("钱七");
m_ListBox2.AddString("方大");
m_ListBox2.AddString("廖九");
m_ListBox2.AddString("冯二");
GetDlgItem(IDC_LEFT) -> EnableWindow(FALSE);
}

void CLISTBOX3Dlg::OnRight() 
{
int index;
CString str;
index = m_ListBox1.GetCurSel();
if(LB_ERR==index) 
return;
m_ListBox1.GetText(index,str);
m_ListBox1.DeleteString(index);
m_ListBox2.AddString(str);
m_ListBox1.SetCurSel(0);
if(0==m_ListBox1.GetCount())
GetDlgItem(IDC_RIGHT) -> EnableWindow(FALSE);
}

void CLISTBOX3Dlg::OnLeft() 
{
int index;
CString str;
index = m_ListBox2.GetCurSel();
if(LB_ERR==index) 
return;
m_ListBox2.GetText(index,str);
m_ListBox2.DeleteString(index);
m_ListBox1.AddString(str);
m_ListBox2.SetCurSel(0);
if(0==m_ListBox2.GetCount())
GetDlgItem(IDC_LEFT) -> EnableWindow(FALSE);
}

void CLISTBOX3Dlg::OnSelchangeListbox1() 
{
GetDlgItem(IDC_RIGHT) -> EnableWindow(TRUE);
}

void CLISTBOX3Dlg::OnSelchangeListbox2() 
{
GetDlgItem(IDC_LEFT) -> EnableWindow(TRUE);
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
初学VC2010之属性页对话框
VC |ADO数据库(Access)编程
串口通信IN C (适用于Microsoft Visual Studio 2010/2012/20...
Extended ComboBox添加图标
一个使用CSocket类的网络通信实例
scoket编程(一对多)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服