コード例 #1
0
        private void RenderLabels(GaugeGraphics g)
        {
            if (!LabelStyle.Visible)
            {
                return;
            }
            double         interval         = GetInterval(IntervalTypes.Labels);
            float          offsetLabelPos   = GetOffsetLabelPos(LabelStyle.Placement, LabelStyle.DistanceFromScale, Position);
            double         minimumLog       = base.MinimumLog;
            double         intervalOffset   = GetIntervalOffset(IntervalTypes.Labels);
            Color          textColor        = LabelStyle.TextColor;
            CustomTickMark endLabelTickMark = GetEndLabelTickMark();

            if (LabelStyle.ShowEndLabels && intervalOffset > 0.0)
            {
                textColor = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor);
                DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, value: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, fontUnit: LabelStyle.FontUnit);
                if (endLabelTickMark != null)
                {
                    DrawTickMark(g, endLabelTickMark, minimumLog, 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 == LabelStyle.Placement && Math.Abs(customLabel.DistanceFromScale - LabelStyle.DistanceFromScale) < 1f)
                    {
                        flag = false;
                    }
                }
                if (!LabelStyle.ShowEndLabels && (minimumLog == base.MinimumLog || minimumLog == base.Maximum))
                {
                    flag = false;
                }
                if (flag)
                {
                    textColor = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor);
                    DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, value: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, fontUnit: LabelStyle.FontUnit);
                }
                num        = minimumLog;
                minimumLog = GetNextPosition(minimumLog, interval, forceLinear: false);
            }
            if (LabelStyle.ShowEndLabels && num < base.Maximum)
            {
                minimumLog = base.Maximum;
                textColor  = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor);
                DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, value: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, fontUnit: LabelStyle.FontUnit);
                if (endLabelTickMark != null)
                {
                    DrawTickMark(g, endLabelTickMark, minimumLog, GetTickMarkOffset(endLabelTickMark));
                }
            }
        }
コード例 #2
0
        internal override void DrawTickMark(GaugeGraphics g, CustomTickMark tickMark, double value, float offset)
        {
            float  num           = GetPositionFromValueNormalized(value);
            PointF absolutePoint = g.GetAbsolutePoint(GetPoint(num, offset));

            using (Matrix matrix = new Matrix())
            {
                matrix.RotateAt(num, absolutePoint);
                if (tickMark.Placement == Placement.Inside)
                {
                    matrix.RotateAt(180f, absolutePoint);
                }
                DrawTickMark(g, tickMark, value, offset, matrix);
            }
        }
コード例 #3
0
        internal override void DrawTickMark(GaugeGraphics g, CustomTickMark tickMark, double value, float offset)
        {
            float  num           = GetPositionFromValue(value);
            PointF absolutePoint = g.GetAbsolutePoint(GetPoint(num, offset));

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