private void CustomDrawItem(ListBoxDrawItemEventArgs e) { double h = _customDrawingPosition / Convert.ToDouble(CustomDrawingPositionMaximum); if (e.IsItemSelected) { h = Math.Abs(1.0 - h); } HSL backColor = new HSL(h, 1, e.ItemIndex % 2 == 0 ? 0.5 : 0.6); using (SolidBrush sb = new SolidBrush(backColor.ToRgb())) { e.Graphics.FillRectangle(sb, e.DrawingBounds); } HSL foreColor = new HSL(Math.Abs(1.0 - h), 1, 0.5); using (SolidBrush sb = new SolidBrush(foreColor.ToRgb())) e.Graphics.DrawString(DemoListBox.GetItemText(e.ItemIndex), DemoListBox.Font, sb, e.DrawingBounds); }
private void CustomDrawingTimer_Tick(object sender, EventArgs e) { if (++_customDrawingPosition > CustomDrawingPositionMaximum) { _customDrawingPosition = 0; } DemoListBox.Refresh(); DemoCheckedListBox.Refresh(); }
private void ClearSelectionButton_Click(object sender, EventArgs e) { DemoListBox.ClearSelection(); DemoCheckedListBox.ClearSelection(); }
private void SelectAllButton_Click(object sender, EventArgs e) { DemoListBox.SelectAllItems(); DemoCheckedListBox.SelectAllItems(); }