/// <summary> /// 绘制显示区域样式 /// </summary> /// <param name="globalView"></param> /// <param name="graphics"></param> /// <param name="globalViewZoomArea"></param> private void DrawDisplayAreaStyle(GlobalViewPlotElementInfo globalView, Graphics graphics, RectangleF globalViewZoomArea) { Pen globalViewZoomAreaPen = globalView.GlobalViewZoomAreaPen; //绘制边框 graphics.DrawRectangle(globalViewZoomAreaPen, globalViewZoomArea.X, globalViewZoomArea.Y, globalViewZoomArea.Width, globalViewZoomArea.Height); //绘制内部细线 float zoomDAEndX = globalViewZoomArea.X + globalViewZoomArea.Width; float zoomDABeginX = globalViewZoomArea.X; float zoomDAY1 = globalViewZoomArea.Y; float zoomDAY2 = zoomDAY1 + globalViewZoomArea.Height; int interval = 2; if (globalViewZoomArea.Width > 20) { //左边竖线 this.DrawVerLine(graphics, globalViewZoomAreaPen, zoomDABeginX + interval, zoomDABeginX + 10, zoomDAY1, zoomDAY2, interval); //右边竖线 this.DrawVerLine(graphics, globalViewZoomAreaPen, zoomDAEndX - 8, zoomDAEndX - 1, zoomDAY1, zoomDAY2, interval); } else { //宽度小于20就左右边一起了 this.DrawVerLine(graphics, globalViewZoomAreaPen, zoomDABeginX + interval, zoomDAEndX, zoomDAY1, zoomDAY2, interval); } }
private RectangleF?DrawGlobalView(Graphics graphics, WavePlotPara plotPara, IEnumerable <ChannelPlotData> plotDatas) { GlobalViewPlotElementInfo globalView = this._globalView; if (globalView == null) { return(null); } //填充整体视图波形背景 if (globalView.BackgroudColor != null) { graphics.FillRectangle(globalView.BackgroudColor, globalView.Area); } if (plotDatas == null) { return(null); } //整体视图中缩放后显示区域 RectangleF?globalViewZoomArea = null; if (this._zoomInfo.HasZoom()) { float x1 = (float)(globalView.Area.Width * plotPara.SBTOMillisecond / plotPara.DurationMillisecond); float x2 = (float)(globalView.Area.Width * plotPara.GetSETOMillisecond() / plotPara.DurationMillisecond); globalViewZoomArea = new RectangleF(x1, globalView.Area.Y, x2 - x1, globalView.Area.Height); graphics.FillRectangle(globalView.GlobalViewZoomAreaBackBrush, globalViewZoomArea.Value); } RectangleF?wavSelectedArea = this.GetSelectedAreaBackground(globalView.Area, plotPara, PlotConstant.ZEROR_D, plotPara.DurationMillisecond); if (wavSelectedArea.HasValue) { //填充选中背景 graphics.FillRectangle(this._seleactionGlobalViewAreaBrush, wavSelectedArea.Value); } //绘制整体视图波形 this.DrawWaveDb(graphics, globalView, plotPara, plotDatas, true); if (globalViewZoomArea.HasValue) { this.DrawDisplayAreaStyle(globalView, graphics, globalViewZoomArea.Value); } return(wavSelectedArea); }