winform里的listbox的问题
来源:百度知道 编辑:UC知道 时间:2024/05/10 00:45:01
我的LISTBOX我做了个单击事件
这样只要点在listbox里都会执行了
我想设置个如果点中的话
我就自己在让listbox第1行上面有个蓝色的框
怎么做啊?谢谢大家了
这样只要点在listbox里都会执行了
我想设置个如果点中的话
我就自己在让listbox第1行上面有个蓝色的框
怎么做啊?谢谢大家了
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 10; i++)
{
this.listBox1.Items.Add("asdf");
}
this.listBox1.GotFocus += new EventHandler(listBox1_GotFocus);
this.listBox1.LostFocus += new EventHandler(listBox1_LostFocus);
}
void listBox1_LostFocus(object sender, EventArgs e)
{
this.listBox1.SelectedIndex = -1;
}
void listBox1_GotFocus(object sender, EventArgs e)
{
this.listBox1.SelectedIndex = 0;
}
看看是不是你要的效果
没看懂?什么意思?
是你自己重载了listbox?
在listbox的前台事件中 增加onselect事件,改变选种的栏位的颜色
“蓝色的框”
说具体点吧,什么蓝色的框呢?
我也没看懂