private void ListFilters_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
if (e.Index != -1)
{
var filter = (PostFilterRule)this.ListFilters.Items[e.Index];
var isSelected = e.State.HasFlag(DrawItemState.Selected);
Brush textBrush;
if (isSelected)
textBrush = SystemBrushes.HighlightText;
else if (filter.Enabled)
textBrush = SystemBrushes.WindowText;
else
textBrush = SystemBrushes.GrayText;
e.Graphics.DrawString(filter.ToString(), e.Font, textBrush, e.Bounds);
}
e.DrawFocusRectangle();
}