void ISelectable.DrawSelection(GaugeGraphics g, bool designTimeSelection) { if (this.GetGauge() != null) { Stack stack = new Stack(); for (NamedElement namedElement = this.GetGauge().ParentObject; namedElement != null; namedElement = (NamedElement)((IRenderable)namedElement).GetParentRenderable()) { stack.Push(namedElement); } foreach (IRenderable item in stack) { g.CreateDrawRegion(item.GetBoundRect(g)); } g.CreateDrawRegion(((IRenderable)this.GetGauge()).GetBoundRect(g)); this.SetDrawRegion(g); Gap gap = new Gap(this.GetRadius()); gap.SetOffset(Placement.Cross, this.Width); gap.SetBase(); if (this.MajorTickMark.Visible) { gap.SetOffsetBase(this.MajorTickMark.Placement, this.MajorTickMark.Length); if (this.MajorTickMark.Placement == Placement.Outside) { gap.Outside = Math.Max(gap.Outside, (float)(this.MajorTickMark.DistanceFromScale + this.MajorTickMark.Length + this.Width / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(0.0 - this.MajorTickMark.DistanceFromScale)); } else if (this.MajorTickMark.Placement == Placement.Cross) { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.MajorTickMark.DistanceFromScale + this.MajorTickMark.Length / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(this.MajorTickMark.DistanceFromScale + this.MajorTickMark.Length / 2.0)); } else { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.MajorTickMark.DistanceFromScale)); gap.Inside = Math.Max(gap.Inside, (float)(this.MajorTickMark.DistanceFromScale + this.MajorTickMark.Length + this.Width / 2.0)); } } if (this.MinorTickMark.Visible) { gap.SetOffsetBase(this.MinorTickMark.Placement, this.MinorTickMark.Length); if (this.MinorTickMark.Placement == Placement.Outside) { gap.Outside = Math.Max(gap.Outside, (float)(this.MinorTickMark.DistanceFromScale + this.MinorTickMark.Length + this.Width / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(0.0 - this.MinorTickMark.DistanceFromScale)); } else if (this.MinorTickMark.Placement == Placement.Cross) { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.MinorTickMark.DistanceFromScale + this.MinorTickMark.Length / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(this.MinorTickMark.DistanceFromScale + this.MinorTickMark.Length / 2.0)); } else { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.MinorTickMark.DistanceFromScale)); gap.Inside = Math.Max(gap.Inside, (float)(this.MinorTickMark.DistanceFromScale + this.MinorTickMark.Length + this.Width / 2.0)); } } if (this.LabelStyle.Visible) { if (this.LabelStyle.Placement == Placement.Outside) { gap.Outside = Math.Max(gap.Outside, (float)(this.LabelStyle.DistanceFromScale + (float)this.LabelStyle.Font.Height + this.Width / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(0.0 - this.LabelStyle.DistanceFromScale)); } else if (this.LabelStyle.Placement == Placement.Cross) { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.LabelStyle.DistanceFromScale + (float)this.LabelStyle.Font.Height / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(this.LabelStyle.DistanceFromScale + (float)this.LabelStyle.Font.Height / 2.0)); } else { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.LabelStyle.DistanceFromScale)); gap.Inside = Math.Max(gap.Inside, (float)(this.LabelStyle.DistanceFromScale + (float)this.LabelStyle.Font.Height + this.Width / 2.0)); } } float angularMargin = 4f; float num = 5f; using (GraphicsPath graphicsPath = this.GetBarPath(gap.Inside + num, gap.Outside + num, angularMargin)) { if (graphicsPath != null) { PointF[] selectionMarkers = this.GetSelectionMarkers(g, gap.Inside + num, gap.Outside + num, angularMargin); g.DrawRadialSelection(g, graphicsPath, selectionMarkers, designTimeSelection, this.Common.GaugeCore.SelectionBorderColor, this.Common.GaugeCore.SelectionMarkerColor); } } g.RestoreDrawRegion(); g.RestoreDrawRegion(); foreach (IRenderable item2 in stack) { IRenderable renderable = item2; g.RestoreDrawRegion(); } } }
private void SetScaleHitTestPath(GaugeGraphics g) { Gap gap = new Gap(this.GetRadius()); gap.SetOffset(Placement.Cross, this.Width); gap.SetBase(); if (this.MajorTickMark.Visible) { gap.SetOffsetBase(this.MajorTickMark.Placement, this.MajorTickMark.Length); if (this.MajorTickMark.Placement == Placement.Outside) { gap.Outside = Math.Max(gap.Outside, (float)(this.MajorTickMark.DistanceFromScale + this.MajorTickMark.Length + this.Width / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(0.0 - this.MajorTickMark.DistanceFromScale)); } else if (this.MajorTickMark.Placement == Placement.Cross) { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.MajorTickMark.DistanceFromScale + this.MajorTickMark.Length / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(this.MajorTickMark.DistanceFromScale + this.MajorTickMark.Length / 2.0)); } else { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.MajorTickMark.DistanceFromScale)); gap.Inside = Math.Max(gap.Inside, (float)(this.MajorTickMark.DistanceFromScale + this.MajorTickMark.Length + this.Width / 2.0)); } } if (this.MinorTickMark.Visible) { gap.SetOffsetBase(this.MinorTickMark.Placement, this.MinorTickMark.Length); if (this.MinorTickMark.Placement == Placement.Outside) { gap.Outside = Math.Max(gap.Outside, (float)(this.MinorTickMark.DistanceFromScale + this.MinorTickMark.Length + this.Width / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(0.0 - this.MinorTickMark.DistanceFromScale)); } else if (this.MinorTickMark.Placement == Placement.Cross) { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.MinorTickMark.DistanceFromScale + this.MinorTickMark.Length / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(this.MinorTickMark.DistanceFromScale + this.MinorTickMark.Length / 2.0)); } else { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.MinorTickMark.DistanceFromScale)); gap.Inside = Math.Max(gap.Inside, (float)(this.MinorTickMark.DistanceFromScale + this.MinorTickMark.Length + this.Width / 2.0)); } } if (this.LabelStyle.Visible) { if (this.LabelStyle.Placement == Placement.Outside) { gap.Outside = Math.Max(gap.Outside, (float)(this.LabelStyle.DistanceFromScale + (float)this.LabelStyle.Font.Height + this.Width / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(0.0 - this.LabelStyle.DistanceFromScale)); } else if (this.LabelStyle.Placement == Placement.Cross) { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.LabelStyle.DistanceFromScale + (float)this.LabelStyle.Font.Height / 2.0)); gap.Inside = Math.Max(gap.Inside, (float)(this.LabelStyle.DistanceFromScale + (float)this.LabelStyle.Font.Height / 2.0)); } else { gap.Outside = Math.Max(gap.Outside, (float)(0.0 - this.LabelStyle.DistanceFromScale)); gap.Inside = Math.Max(gap.Inside, (float)(this.LabelStyle.DistanceFromScale + (float)this.LabelStyle.Font.Height + this.Width / 2.0)); } } GraphicsPath barPath = this.GetBarPath(gap.Inside, gap.Outside, 0f); this.Common.GaugeCore.HotRegionList.SetHotRegion(this, g.GetAbsolutePoint(this.GetPivotPoint()), barPath); }