protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (!Enable) { if (ellipseBarRect.Contains(e.Location) && !_isEllipeBarDown) { _isEllipeBarHover = true; } else if (!ellipseBarRect.Contains(e.Location)) { ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object obj) { if (topInfoRect.Contains(e.Location)) { foreach (SmallButton item in _buttons) { if (item.ButtonRect.Contains(e.Location)) { this.Invoke(new MethodInvoker(delegate() { this.Cursor = Cursors.Hand; })); item.DownState = DownState.Hover; _hoverButton = item; base.Invalidate(item.ButtonRect); return; } else if (_hoverButton != null && !_hoverButton.ButtonRect.Contains(e.Location)) { _hoverButton = null; this.Invoke(new MethodInvoker(delegate() { this.Cursor = Cursors.Default; })); } } } else { this.Invoke(new MethodInvoker(delegate() { this.Cursor = Cursors.Default; })); _hoverButton = null; for (int i = 0; i < Items.Count; i++) { MusicEntity item = Items[i]; if (item.Rect.Contains(e.Location)) { _hoverEntity = item; base.Invalidate(item.Rect); return; } } } })); } else { _isEllipeBarHover = false; } if (_isEllipeBarDown) { int y = e.Y - jY; if (y < topInfoRect.Y + topInfoRect.Height + 2) y = topInfoRect.Y + topInfoRect.Height + 2; if (y > this.Height - ellipseBarRect.Height - 1) y = this.Height - ellipseBarRect.Height - 1; ellipseBarRect = new Rectangle( ellipseBarRect.X, y, ellipseBarRect.Width, ellipseBarRect.Height); } base.Invalidate(); } }
protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); _isEllipeBarDown = false; _isEllipeBarHover = false; _hoverEntity = null; _hoverButton = null; base.Invalidate(); }