Example #1
0
        private static void CustomFormatItem(ListBoxFormatItemEventArgs e, ListBox listBox)
        {
            if(e.Value == null)
                return;

            StringBuilder sb = new StringBuilder();
            string s = e.Value.ToString();

            bool hovered = listBox.IsItemHovered(e.ItemIndex);

            if(listBox.IsItemSelected(e.ItemIndex))
            {
                sb.AppendFormat("--> {0} <--", s);
            }
            else
            {
                sb.Append(s.Replace(' ', hovered ? '-' : '_'));
            }

            e.Value = sb.ToString();
        }