透明列表框 [英] Transparent list box
本文介绍了透明列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在MFC,C ++的透明列表框中实现列表框选择(选定的文本背景颜色)以显示默认颜色或用户定义的颜色?
Is it possible to achieve ,on list box selection(selected text background color) to show Default color or user defined color in transparent list box in MFC,C++ ?
推荐答案
尝试使用以下方法更改颜色:
try changing the color using:
//lbDemo is a ListBox control.
protected void lbDemo_SelectedIndexChanged(object sender, EventArgs e)
{
setItem(lbDemo, lbDemo.SelectedIndex);
}
void setItem(ListBox lb,int SelectedIndex)
{
foreach (ListItem li in lb.Items)
{
li.Attributes.Add("style", "color:black");
}
lb.Items[SelectedIndex].Attributes.Add("style", "color:blue");
}
这篇关于透明列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文