sdk listbox控件如何使选中项高亮显示
1个回答
展开全部
//listView1鼠标离开后高亮显示
private void listView1_Validated(object sender, EventArgs e)
{
if (listView1.FocusedItem != null)
{
listView1.FocusedItem.UseItemStyleForSubItems = true;//继承正行颜色
listView1.FocusedItem.BackColor = SystemColors.Highlight;
listView1.FocusedItem.ForeColor = Color.White;
}
}
//listView1鼠标离开后高亮显示
private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
e.Item.BackColor = SystemColors.Window;
e.Item.ForeColor = Color.Black;
if (listView1.FocusedItem != null)
{
listView1.FocusedItem.Selected = true;
//listView1.Items[1].Selected = true;
}
}
private void listView1_Validated(object sender, EventArgs e)
{
if (listView1.FocusedItem != null)
{
listView1.FocusedItem.UseItemStyleForSubItems = true;//继承正行颜色
listView1.FocusedItem.BackColor = SystemColors.Highlight;
listView1.FocusedItem.ForeColor = Color.White;
}
}
//listView1鼠标离开后高亮显示
private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
e.Item.BackColor = SystemColors.Window;
e.Item.ForeColor = Color.Black;
if (listView1.FocusedItem != null)
{
listView1.FocusedItem.Selected = true;
//listView1.Items[1].Selected = true;
}
}
追问
这是VB吧 ,能用 C 语言 调用API的方式写出来吗 谢谢
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询