private PianoMouseEventArgs RiseMouseHandle(object sender, MouseEventArgs e, OnMouseEventHandler Roll, OnMouseEventHandler Title, OnMouseEventHandler Track) { PianoMouseEventArgs pme = new PianoMouseEventArgs(e); pme.CalcAxis(pprops, rconf, pme_cache); OnMouseEventHandler Handle = null; switch (pme.Area) { case PianoMouseEventArgs.AreaType.Roll: Handle = Roll; break; case PianoMouseEventArgs.AreaType.Title: Handle = Title; break; case PianoMouseEventArgs.AreaType.Track: Handle = Track; break; } if (Handle != null) { Handle(sender, pme); } return(pme); }
private void d2DPainterBox1_MouseMove(object sender, MouseEventArgs e) { if (DisableMouse) { return; } if (isMMoving) { return; } isMMoving = true; d2DPainterBox1.Refresh(); PianoMouseEventArgs pme = new PianoMouseEventArgs(e); pme.CalcAxis(pprops, rconf, pme_cache); OnMouseEventHandler Handle = null; //Move事件 EventHandler HandleEnter = null; //Enter事件 EventHandler HandleLeave = null; //Leave事件 switch (pme.Area) { case PianoMouseEventArgs.AreaType.Roll: Handle = RollMouseMove; HandleEnter = RollMouseEnter; break; case PianoMouseEventArgs.AreaType.Title: Handle = TitleMouseMove; HandleEnter = TitleMouseEnter; break; case PianoMouseEventArgs.AreaType.Track: Handle = TrackMouseMove; HandleEnter = TrackMouseEnter; break; } if (pme_sendEnterEvent) { if (HandleEnter != null) { HandleEnter(sender, e); } } else if (pme_cache.Area != pme.Area) { switch (pme_cache.Area) { case PianoMouseEventArgs.AreaType.Roll: HandleLeave = RollMouseLeave; break; case PianoMouseEventArgs.AreaType.Title: HandleLeave = TitleMouseLeave; break; case PianoMouseEventArgs.AreaType.Track: HandleLeave = TrackMouseLeave; break; } if (HandleEnter != null) { HandleEnter(sender, e); } if (HandleLeave != null) { HandleLeave(sender, e); } } if (Handle != null) { Handle(sender, pme); //发送Move } pme_cache = pme; pme_sendEnterEvent = false; this.OnMouseMove(e); isMMoving = false; }