标签:var cli csharp data dev mil item arp box
private void Init()
{
List<Funcation> data = new List<Funcation>();
data.Add(new Funcation() { FunctionName = "测试窗体", FunctionKey = "DevDemoList.frmedit" });
data.Add(new Funcation() { FunctionName = "RibbonForm窗体", FunctionKey = "DevDemoList.frmMain" });
lsbFunction.DataSource = data;
lsbFunction.DisplayMember = "FunctionName";
lsbFunction.ValueMember = "FunctionKey";
}
private void listBoxControl1_Click(object sender, EventArgs e)
{
var SelectRow = lsbFunction.GetItem(lsbFunction.SelectedIndex) as Funcation;
if (SelectRow != null)
AddDocument(SelectRow);
}
选中的样式
先设置属性
private void lsbFunction_DrawItem(object sender, ListBoxDrawItemEventArgs e)
{
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{
e.Appearance.BackColor = Color.SkyBlue;
e.Appearance.ForeColor = Color.White;
}
}
设置行高 ItemHeight=26
标签:var cli csharp data dev mil item arp box
原文地址:https://www.cnblogs.com/shuaimeng/p/9717429.html