Exemplo n.º 1
0
 private void RenderLabels(GaugeGraphics g)
 {
     if (this.LabelStyle.Visible)
     {
         double         interval         = base.GetInterval(IntervalTypes.Labels);
         float          offsetLabelPos   = base.GetOffsetLabelPos(this.LabelStyle.Placement, this.LabelStyle.DistanceFromScale, this.Position);
         double         minimumLog       = base.MinimumLog;
         double         intervalOffset   = base.GetIntervalOffset(IntervalTypes.Labels);
         Color          textColor        = this.LabelStyle.TextColor;
         CustomTickMark endLabelTickMark = base.GetEndLabelTickMark();
         if (this.LabelStyle.ShowEndLabels && intervalOffset > 0.0)
         {
             textColor = base.GetRangeLabelsColor(minimumLog, this.LabelStyle.TextColor);
             string labelStr = (this.Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, this.LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : this.Common.GaugeContainer.FormatNumberHandler(this.Common.GaugeContainer, minimumLog * base.Multiplier, this.LabelStyle.FormatString);
             this.DrawLabel(this.LabelStyle.Placement, labelStr, minimumLog, offsetLabelPos, this.LabelStyle.FontAngle, this.LabelStyle.Font, textColor, this.LabelStyle.FontUnit);
             if (endLabelTickMark != null)
             {
                 this.DrawTickMark(g, endLabelTickMark, minimumLog, base.GetTickMarkOffset(endLabelTickMark));
             }
         }
         minimumLog += intervalOffset;
         double num = 0.0;
         while (minimumLog <= base.Maximum)
         {
             bool flag = true;
             foreach (CustomLabel customLabel in base.CustomLabels)
             {
                 if (Math.Abs(customLabel.Value - minimumLog) < 1E-07 && customLabel.Placement == this.LabelStyle.Placement && Math.Abs(customLabel.DistanceFromScale - this.LabelStyle.DistanceFromScale) < 1.0)
                 {
                     flag = false;
                 }
             }
             if (!this.LabelStyle.ShowEndLabels && (minimumLog == base.MinimumLog || minimumLog == base.Maximum))
             {
                 flag = false;
             }
             if (flag)
             {
                 textColor = base.GetRangeLabelsColor(minimumLog, this.LabelStyle.TextColor);
                 string labelStr2 = (this.Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, this.LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : this.Common.GaugeContainer.FormatNumberHandler(this.Common.GaugeContainer, minimumLog * base.Multiplier, this.LabelStyle.FormatString);
                 this.DrawLabel(this.LabelStyle.Placement, labelStr2, minimumLog, offsetLabelPos, this.LabelStyle.FontAngle, this.LabelStyle.Font, textColor, this.LabelStyle.FontUnit);
             }
             num        = minimumLog;
             minimumLog = base.GetNextPosition(minimumLog, interval, false);
         }
         if (this.LabelStyle.ShowEndLabels && num < base.Maximum)
         {
             minimumLog = base.Maximum;
             textColor  = base.GetRangeLabelsColor(minimumLog, this.LabelStyle.TextColor);
             string labelStr3 = (this.Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, this.LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : this.Common.GaugeContainer.FormatNumberHandler(this.Common.GaugeContainer, minimumLog * base.Multiplier, this.LabelStyle.FormatString);
             this.DrawLabel(this.LabelStyle.Placement, labelStr3, minimumLog, offsetLabelPos, this.LabelStyle.FontAngle, this.LabelStyle.Font, textColor, this.LabelStyle.FontUnit);
             if (endLabelTickMark != null)
             {
                 this.DrawTickMark(g, endLabelTickMark, minimumLog, base.GetTickMarkOffset(endLabelTickMark));
             }
         }
     }
 }
Exemplo n.º 2
0
        public override void DrawTickMark(GaugeGraphics g, CustomTickMark tickMark, double value, float offset)
        {
            float  num           = this.GetPositionFromValueNormalized(value);
            PointF absolutePoint = g.GetAbsolutePoint(this.GetPoint(num, offset));

            using (Matrix matrix = new Matrix())
            {
                matrix.RotateAt(num, absolutePoint);
                if (tickMark.Placement == Placement.Inside)
                {
                    matrix.RotateAt(180f, absolutePoint);
                }
                base.DrawTickMark(g, tickMark, value, offset, matrix);
            }
        }
Exemplo n.º 3
0
        public override void DrawTickMark(GaugeGraphics g, CustomTickMark tickMark, double value, float offset)
        {
            float  num           = this.GetPositionFromValue(value);
            PointF absolutePoint = g.GetAbsolutePoint(this.GetPoint(num, offset));

            using (Matrix matrix = new Matrix())
            {
                if (this.ParentGauge.GetOrientation() == GaugeOrientation.Vertical)
                {
                    matrix.RotateAt(90f, absolutePoint);
                }
                if (tickMark.Placement == Placement.Outside)
                {
                    matrix.RotateAt(180f, absolutePoint);
                }
                base.DrawTickMark(g, tickMark, value, offset, matrix);
            }
        }