Exemplo n.º 1
0
 private void Draw(PaintArgs p, Pen pen, PlotDataCursorDisplayCollection displays)
 {
     if (this.HitRegion != null)
     {
         this.HitRegion.Dispose();
         this.HitRegion = null;
     }
     if (this.Visible && this.DataCursor != null && this.XAxis != null && this.YAxis != null)
     {
         bool     swap              = this.Style == PlotAxisReference.YAxis ^ this.DataCursor.XYSwapped;
         PlotAxis axisPosition      = this.AxisPosition;
         PlotAxis axisRange         = this.AxisRange;
         int      positionPixels    = this.PositionPixels;
         int      dataViewPixelsMin = axisRange.DataViewPixelsMin;
         int      dataViewPixelsMax = axisRange.DataViewPixelsMax;
         this.m_PositionArray.Clear();
         this.m_PositionArray.Add(dataViewPixelsMin);
         this.m_PositionArray.Add(dataViewPixelsMax);
         if (this.DataCursor.WindowShowing)
         {
             foreach (PlotDataCursorDisplay display in displays)
             {
                 if (!display.DisableWindow)
                 {
                     if (this.Style == PlotAxisReference.XAxis)
                     {
                         this.m_PositionArray.Add(this.AxisRange.PercentToPixels(display.YPosition) - this.DataCursor.Window.Size);
                         this.m_PositionArray.Add(this.AxisRange.PercentToPixels(display.YPosition) + this.DataCursor.Window.Size);
                     }
                     else
                     {
                         this.m_PositionArray.Add(this.AxisRange.PercentToPixels(display.XPosition) - this.DataCursor.Window.Size);
                         this.m_PositionArray.Add(this.AxisRange.PercentToPixels(display.XPosition) + this.DataCursor.Window.Size);
                     }
                 }
             }
         }
         this.m_PositionArray.Sort();
         for (int i = 0; i < this.m_PositionArray.Count; i += 2)
         {
             Point pt  = iDraw.Point(swap, positionPixels, (int)this.m_PositionArray[i]);
             Point pt2 = iDraw.Point(swap, positionPixels, (int)this.m_PositionArray[i + 1]);
             p.Graphics.DrawLine(pen, pt, pt2);
         }
         Rectangle b = iRectangle.FromLTRB(swap, positionPixels, dataViewPixelsMin, positionPixels, dataViewPixelsMax);
         b.Inflate(this.DataCursor.HitRegionSize, this.DataCursor.HitRegionSize);
         GraphicsPath graphicsPath = new GraphicsPath();
         graphicsPath.AddRectangle(Rectangle.Intersect(this.DataCursor.BoundsClip, b));
         this.HitRegion        = new Region(graphicsPath);
         this.m_PositionPixels = positionPixels;
     }
 }
Exemplo n.º 2
0
 protected override void CreateObjects()
 {
     base.CreateObjects();
     this.m_Line = new PlotPen();
     base.AddSubClass(this.Line);
     this.I_Line = this.Line;
     this.m_Hint = new PlotDataCursorHint(this);
     base.AddSubClass(this.Hint);
     this.I_Hint   = this.Hint;
     this.m_Window = new PlotDataCursorWindow(this);
     base.AddSubClass(this.Window);
     this.I_Window   = this.Window;
     this.m_Pointer1 = new PlotDataCursorPointer(this);
     base.AddSubClass(this.Pointer1);
     this.I_Pointer1 = this.Pointer1;
     this.m_Pointer2 = new PlotDataCursorPointer(this);
     base.AddSubClass(this.Pointer2);
     this.I_Pointer2 = this.Pointer2;
     this.m_Displays = new PlotDataCursorDisplayCollection();
     ((ISubClassBase)this.Line).ColorAmbientSource = AmbientColorSouce.Color;
     this.m_Pointer1.PropertyChanged += this.m_Pointer_PropertyChanged;
     this.m_Pointer2.PropertyChanged += this.m_Pointer_PropertyChanged;
 }
Exemplo n.º 3
0
 void IPlotDataCursorPointer.Draw(PaintArgs p, Pen pen, PlotDataCursorDisplayCollection displays)
 {
     this.Draw(p, pen, displays);
 }