protected override void OnMouseDown(MouseEventArgs e) { selectedIndex = KeyFromPoint(e.Location); if (selectedIndex >= 0) { velocities[selectedIndex] = 1; if (VelocityChanged != null) { VelocityChanged.Invoke(this, new KeyInputEvent { Note = selectedIndex + offset, Velocity = velocities[selectedIndex] }); } PianoKeyDown?.Invoke(this, new KeyInputEvent { Note = selectedIndex + offset }); Invalidate(); } base.OnMouseDown(e); }
protected virtual void OnPianoKeyDown(PianoKeyEventArgs e) { PianoKeyDown?.Invoke(this, e); }