/// <summary> /// When the mouse moves over an item on the list we highlight the item. /// </summary> /// <param name="e"></param> protected override void OnMouseMove(MouseEventArgs e) { var item = ItemAt(e.Location); Region invalid = new Region(); if (item != _HotItem) { //unhighlight any item that was previously highlighted if (_HotItem != null) { _HotItem.ExpandHot = false; _HotItem.Highlighted = false; invalid.Union(_HotItem.Bounds); } _HotItem = item; if (item != null) { invalid.Union(item.Bounds); } } if (_HotItem != null) { _HotItem.Highlighted = true; bool expandHot = _HotItem.ExpandBox.Contains(e.Location); if (expandHot != _HotItem.ExpandHot) { invalid.Union(_HotItem.ExpandBox); } _HotItem.ExpandHot = expandHot; _HotItem.HandleMouseMove(e); } Invalidate(invalid); }