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; }
private void Draw(PaintArgs p, PlotDataCursorDisplay display) { int num = 3; if (this.DataCursor.WindowShowing) { num += this.DataCursor.Window.Size; } if (this.HitRegion != null) { this.HitRegion.Dispose(); this.HitRegion = null; } if (this.Visible && !this.Hide && this.DataCursor != null && this.XAxis != null && this.YAxis != null) { PlotDataCursorPointer pointer = this.DataCursor.Pointer1; PlotDataCursorPointer pointer2 = this.DataCursor.Pointer2; Pen pen = p.Graphics.Pen(this.DataCursor.Line.Color, DashStyle.Dash, (float)this.DataCursor.Line.Thickness); bool flag; int num2; if (pointer.Visible && pointer2.Visible && pointer.AxisPosition == pointer2.AxisPosition) { flag = true; this.AxisPosition = pointer.AxisRange; num2 = (pointer.PositionPixels + pointer2.PositionPixels) / 2; } else if (pointer.Visible && pointer2.Visible) { flag = false; if (pointer.AxisRange.DockHorizontal) { this.AxisPosition = pointer.AxisRange; num2 = pointer.PositionPixels; } else { this.AxisPosition = pointer2.AxisRange; num2 = pointer2.PositionPixels; } } else { flag = false; if (pointer.Visible) { this.AxisPosition = pointer.AxisRange; num2 = pointer.AxisPosition.PercentToPixels(display.XPosition); } else { this.AxisPosition = pointer2.AxisRange; num2 = pointer2.AxisPosition.PercentToPixels(display.YPosition); } } Orientation orientation = this.AxisPosition.DockHorizontal ? Orientation.Vertical : Orientation.Horizontal; Size size = p.Graphics.MeasureString(this.Text, this.Font); int width = size.Width; int height = size.Height; int num3 = width + 6; int num4 = height + 6; int num5 = this.AxisPosition.PercentToPixels(display.HintPosition); Rectangle r; if (orientation == Orientation.Vertical) { int num6 = width + num + 6; r = new Rectangle(num2 - num3 / 2, num5 - num4 / 2, num3, num4); if (!flag) { if (num2 + num6 > this.DataCursor.BoundsClip.Right) { r.Offset(-(num3 / 2 + num), 0); } else { r.Offset(num3 / 2 + num, 0); } } else { p.Graphics.DrawLine(pen, pointer.PositionPixels, num5, pointer2.PositionPixels, num5); } } else { int num6 = height + num + 6; r = new Rectangle(num5 - num3 / 2, num2 - num4 / 2, num3, num4); if (!flag) { if (num2 + num6 > this.DataCursor.BoundsClip.Bottom) { r.Offset(0, -(num4 / 2 + num)); } else { r.Offset(0, num4 / 2 + num); } } else { p.Graphics.DrawLine(pen, num5, pointer.PositionPixels, num5, pointer2.PositionPixels); } } this.DrawHintBox(p, r); } }