如何重绘CheckedListBox控件中的项?

时间:2016-05-24 08:35:38

标签: c# windows winforms checkedlistbox

目前我正在开发WindowsForms应用程序。因为我使用了checkedlistbox来显示组合框列的显示成员。我需要绘制组合框列的显示成员而不是值成员,如何更改checkedListBox项的文本。

internal class CheckedListBoxAdv:System.Windows.Forms.CheckedListBox
{

public CheckedListBoxAdv()
      :base()
{ }
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)
{
   if(this.Items.Count > 0)
   {
      if (excelFilter.displayMemberColList.ContainsKey(this.Items[e.Index].ToString()))
                            e.Graphics.DrawString(excelFilter.displayMemberColList[this.Items[e.Index].ToString()], Font, Brushes.Black, e.Bounds);
   }

}
base.OnDrawItem(e);
}
     }

0 个答案:

没有答案
相关问题