FastReport

Форк
0
101 строка · 2.5 Кб
1
using System.ComponentModel;
2
using System.Drawing;
3
using System.Drawing.Drawing2D;
4
using FastReport.Utils;
5

6
namespace FastReport.Gauge.Linear
7
{
8
    /// <summary>
9
    /// Represents a linear gauge.
10
    /// </summary>
11
    public partial class LinearGauge : GaugeObject
12
    {
13
        #region Fields
14

15
        private bool inverted;
16

17
        #endregion // Fields
18

19
        #region Properties
20

21
        /// <summary>
22
        /// Gets or sets the value that specifies inverted gauge or not.
23
        /// </summary>
24
        [Category("Appearance")]
25
        public bool Inverted
26
        {
27
            get { return inverted; }
28
            set { inverted = value; }
29
        }
30

31
        /// <summary>
32
        /// Gets or sets gauge label.
33
        /// </summary>
34
        [Browsable(false)]
35
        public override GaugeLabel Label
36
        {
37
            get { return base.Label; }
38
            set { base.Label = value; }
39
        }
40

41
        #endregion // Properties
42

43
        #region Constructors
44

45
        /// <summary>
46
        /// Initializes a new instance of the <see cref="LinearGauge"/> class.
47
        /// </summary>
48
        public LinearGauge() : base()
49
        {
50
            InitializeComponent();
51
            Scale = new LinearScale(this);
52
            Pointer = new LinearPointer(this);
53
            Height = 2.0f * Units.Centimeters;
54
            Width = 8.0f * Units.Centimeters;
55
            inverted = false;
56
        }
57

58
        #endregion // Constructors
59

60
        #region Public Methods
61

62
        /// <inheritdoc/>
63
        public override void Assign(Base source)
64
        {
65
            base.Assign(source);
66

67
            LinearGauge src = source as LinearGauge;
68
            Inverted = src.Inverted;
69
        }
70

71
        /// <inheritdoc/>
72
        public override void Draw(FRPaintEventArgs e)
73
        {
74
            IGraphics g = e.Graphics;
75
            if (Report != null && Report.SmoothGraphics)
76
            {
77
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
78
                g.SmoothingMode = SmoothingMode.AntiAlias;
79
            }
80

81
            base.Draw(e);
82
            Scale.Draw(e);
83
            Pointer.Draw(e);
84
            Border.Draw(e, new RectangleF(AbsLeft, AbsTop, Width, Height));
85
        }
86

87
        /// <inheritdoc/>
88
        public override void Serialize(FRWriter writer)
89
        {
90
            LinearGauge c = writer.DiffObject as LinearGauge;
91
            base.Serialize(writer);
92

93
            if (Inverted != c.Inverted)
94
            {
95
                writer.WriteBool("Inverted", Inverted);
96
            }
97
        }
98

99
        #endregion // Public Methods
100
    }
101
}
102

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.