コード例 #1
0
        private void CalculateLabelStyle(LabelStyle?style, LabelStyle?min, LabelStyle?max, double value)
        {
            if (style == null)
            {
                return;
            }
            style.CollisionDetection = min?.CollisionDetection ?? false;
            style.Enabled            = InterpolateBool(min?.Enabled ?? false, max?.Enabled ?? false, value);
            style.LabelColumn        = InterpolateString(min?.LabelColumn, max?.LabelColumn, value);

            var fontSize = InterpolateDouble(min?.Font.Size, max?.Font.Size, value);

            style.Font = new Font {
                FontFamily = min?.Font.FontFamily, Size = fontSize
            };

            if (min?.BackColor != null && max?.BackColor != null)
            {
                style.BackColor = InterpolateBrush(min.BackColor, max.BackColor, value);
            }

            style.ForeColor = TextColorBlend == null?
                              InterpolateColor(min?.ForeColor, max?.ForeColor, value) :
                                  TextColorBlend.GetColor(Convert.ToSingle(Fraction(value)));

            if (min?.Halo != null && max?.Halo != null)
            {
                style.Halo = InterpolatePen(min.Halo, max.Halo, value);
            }

            var x = InterpolateDouble(min?.Offset.X, max?.Offset.X, value);
            var y = InterpolateDouble(min?.Offset.Y, max?.Offset.Y, value);

            style.Offset = new Offset {
                X = x, Y = y
            };
            style.LabelColumn = min?.LabelColumn;
        }