示例#1
0
        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);
        }
示例#2
0
 protected virtual void OnPianoKeyDown(PianoKeyEventArgs e)
 {
     PianoKeyDown?.Invoke(this, e);
 }