/// <summary> /// 重写OnMouseMove /// </summary> /// <param name="e"></param> protected override void OnMouseMove(MouseEventArgs e) { try { if (this._plotPara == null) { return; } this._currentMouseArgs = e; UIArea area = this.GetUIArea(this._currentMouseArgs.Location, this._plotPara, this._selectedInfo); this.SetZoomWavMoveMouseStyle(area); switch (area) { case UIArea.GlobalViewZoomDisplay: if (e.Button != MouseButtons.Left || !this._zoomInfo.HasZoom()) { return; } //有缩放时,拖动全局视图进行移动,改变放大后显示区域 double moveMillisecond = (e.X - this._lastMouseDownMoveLocation.X) * this._plotPara.DurationMillisecond / this._content.Area.Width; double sbtoMillisecond = this._plotPara.SBTOMillisecond + moveMillisecond; double setoMillisecond; if (sbtoMillisecond < PlotConstant.ZEROR_D) { sbtoMillisecond = 0; setoMillisecond = this._plotPara.GetSETOMillisecond() - this._plotPara.SBTOMillisecond; } else { setoMillisecond = this._plotPara.GetSETOMillisecond() + moveMillisecond; if (this._plotPara.DurationMillisecond - setoMillisecond < PlotConstant.ZEROR_D) { setoMillisecond = this._plotPara.DurationMillisecond; sbtoMillisecond = setoMillisecond - (this._plotPara.GetSETOMillisecond() - this._plotPara.SBTOMillisecond); } } this._plotPara.SBTOMillisecond = sbtoMillisecond; this._plotPara.UpdateSETOMillisecond(setoMillisecond); this.Resample(); this.PartDraw_ZoomMove(); break; case UIArea.Wave: case UIArea.Voice: if (e.Button != MouseButtons.Right) { return; } //波形图和语谱图上选中区域改变 int mouseDownX = this._mouseDownArgs.Location.X; float beginX, endX; if (e.X < mouseDownX) { beginX = e.X; endX = mouseDownX; } else { beginX = mouseDownX; endX = e.X; } double setOMillisecond = this._plotPara.GetSETOMillisecond(); double unitTime = (setOMillisecond - this._plotPara.SBTOMillisecond) / this._content.Area.Width; double beginMillisecond = this._plotPara.SBTOMillisecond + beginX * unitTime; double endMillisecond = this._plotPara.SBTOMillisecond + endX * unitTime; SelectedInfo oldSelectedInfo = this._selectedInfo; this._selectedInfo = new SelectedInfo(this._plotPara.BaseTime, beginMillisecond, endMillisecond); this.SelectedAreaChangeDraw(oldSelectedInfo); break; case UIArea.WaveSelected: case UIArea.VoiceSelected: default: break; } } catch (Exception ex) { Loger.Error(ex); } finally { this._lastMouseDownMoveLocation = e.Location; base.OnMouseMove(e); } }