看到你的提问:
vc 已经给list控件加了复选框,可是不知道如何获取已经选中了哪些项,望高手指点
悬赏分:20 - 解决时间:2009-6-2 13:34
希望简单写几句示例代码,谢谢
你说你自己解决了。
能做到我的题目上面的功能吗?我勾选某一个的时候:提示我选了哪几个?
有没有VC++的代码?
我不会C#
//c#中用 checkedListBox 控件,知道我勾选了哪几个 实现代码如下
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace test4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label3.Text = "";
label2.Text = "选择的序号分别为->";
}
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
if (checkedListBox1.CheckedItems.Contains(checkedListBox1.Items[i]))//判断是不是勾选了,序号从0开始
{ label3.Text += i.ToString() + "|"; }
}
}
}
}
//不还意思,我c++太久没玩了...帮不上忙