private void d2DPainterBox1_MouseMove(object sender, MouseEventArgs e) { if (DisableMouse) { return; } if (isMMoving) { return; } isMMoving = true; d2DPainterBox1.Refresh(); ParamMouseEventArgs pme = new ParamMouseEventArgs(e); pme.CalcAxis(pprops, rconf, pme_cache, this.ClientRectangle.Height); OnMouseEventHandler Handle = null; //Move事件 EventHandler HandleEnter = null; //Enter事件 EventHandler HandleLeave = null; //Leave事件 switch (pme.Area) { case ParamMouseEventArgs.AreaType.Area: Handle = ParamAreaMouseMove; HandleEnter = ParamAreaMouseEnter; break; case ParamMouseEventArgs.AreaType.Btns: Handle = ParamBtnsMouseMove; HandleEnter = ParamBtnsMouseEnter; break; } if (pme_sendEnterEvent) { if (HandleEnter != null) { HandleEnter(sender, e); } } else if (pme_cache.Area != pme.Area) { switch (pme_cache.Area) { case ParamMouseEventArgs.AreaType.Area: HandleLeave = ParamAreaMouseLeave; break; case ParamMouseEventArgs.AreaType.Btns: HandleLeave = ParamBtnsMouseLeave; 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; }
private void d2DPainterBox1_MouseDoubleClick(object sender, MouseEventArgs e) { // if (DisableMouse) return; pme_cache = RiseMouseHandle(sender, e, ParamAreaMouseDoubleClick, ParamBtnsMouseDoubleClick); this.OnMouseDoubleClick(e); }
private void d2DPainterBox1_MouseUp(object sender, MouseEventArgs e) { if (DisableMouse) { return; } if (isMUp) { return; } isMUp = true; pme_cache = RiseMouseHandle(sender, e, ParamAreaMouseUp, ParamBtnsMouseUp); this.OnMouseUp(e); isMUp = false; }
private ParamMouseEventArgs RiseMouseHandle(object sender, MouseEventArgs e, OnMouseEventHandler Area, OnMouseEventHandler Btns) { ParamMouseEventArgs pme = new ParamMouseEventArgs(e); pme.CalcAxis(pprops, rconf, pme_cache, this.ClientRectangle.Height); OnMouseEventHandler Handle = null; switch (pme.Area) { case ParamMouseEventArgs.AreaType.Btns: Handle = Btns; break; case ParamMouseEventArgs.AreaType.Area: Handle = Area; break; } if (Handle != null) { Handle(sender, pme); } return(pme); }
internal void CalcAxis(PianoProperties pprops, RollConfigures rconf, ParamMouseEventArgs cache, long windowheight) { if (cache != null && cache.MouseEventArgs.X == _me.X && cache.MouseEventArgs.Y == _me.Y) { _tick = cache.Tick; _area = cache.Area; if (windowheight == cache.windowheight) { _tallPercent = cache._tallPercent; } else { _tallPercent = CalcPercent(_me.Y, windowheight); cache._tallPercent = _tallPercent; cache.windowheight = windowheight; } } else { CalcAxis(pprops, rconf, windowheight); } }