/// <summary> /// Handles MouseMove events /// </summary> /// <param name="e"></param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); _HitItem = GetHitItem(e.Location); if (_HitItem != _LastHitItem) { _LastHitItem = _HitItem; Invalidate(); } }
/// <summary> /// Handles MouseUp events /// </summary> /// <param name="e"></param> protected override void OnMouseUp(MouseEventArgs e) { // Change the state colorIndex // if the user clicked on an item. if (_MouseDownItem != null && _MouseDownItem == _HitItem) { _MouseDownItem.ColorIndex = (_MouseDownItem.ColorIndex + 1) % imageList1.Images.Count; OnValueChanged(); } _MouseDownItem = null; base.OnMouseUp(e); }
/// <summary> /// Sets the states "string" value /// </summary> /// <param name="value"></param> private void SetStates(string value) { if (value == null) { _States = null; } else { string[] states = value.Split(','); _States = new MyState[states.Length]; int i = 0; foreach (string s in states) { int n; int.TryParse(s, out n); _States[i++] = new MyState(n); } } _NeedRecalc = true; }
/// <summary> /// Handles MouseDown events /// </summary> /// <param name="e"></param> protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); _MouseDownItem = _HitItem; }