FastReport
101 строка · 2.5 Кб
1using System.ComponentModel;2using System.Drawing;3using System.Drawing.Drawing2D;4using FastReport.Utils;5
6namespace FastReport.Gauge.Linear7{
8/// <summary>9/// Represents a linear gauge.10/// </summary>11public partial class LinearGauge : GaugeObject12{13#region Fields14
15private bool inverted;16
17#endregion // Fields18
19#region Properties20
21/// <summary>22/// Gets or sets the value that specifies inverted gauge or not.23/// </summary>24[Category("Appearance")]25public bool Inverted26{27get { return inverted; }28set { inverted = value; }29}30
31/// <summary>32/// Gets or sets gauge label.33/// </summary>34[Browsable(false)]35public override GaugeLabel Label36{37get { return base.Label; }38set { base.Label = value; }39}40
41#endregion // Properties42
43#region Constructors44
45/// <summary>46/// Initializes a new instance of the <see cref="LinearGauge"/> class.47/// </summary>48public LinearGauge() : base()49{50InitializeComponent();51Scale = new LinearScale(this);52Pointer = new LinearPointer(this);53Height = 2.0f * Units.Centimeters;54Width = 8.0f * Units.Centimeters;55inverted = false;56}57
58#endregion // Constructors59
60#region Public Methods61
62/// <inheritdoc/>63public override void Assign(Base source)64{65base.Assign(source);66
67LinearGauge src = source as LinearGauge;68Inverted = src.Inverted;69}70
71/// <inheritdoc/>72public override void Draw(FRPaintEventArgs e)73{74IGraphics g = e.Graphics;75if (Report != null && Report.SmoothGraphics)76{77g.InterpolationMode = InterpolationMode.HighQualityBicubic;78g.SmoothingMode = SmoothingMode.AntiAlias;79}80
81base.Draw(e);82Scale.Draw(e);83Pointer.Draw(e);84Border.Draw(e, new RectangleF(AbsLeft, AbsTop, Width, Height));85}86
87/// <inheritdoc/>88public override void Serialize(FRWriter writer)89{90LinearGauge c = writer.DiffObject as LinearGauge;91base.Serialize(writer);92
93if (Inverted != c.Inverted)94{95writer.WriteBool("Inverted", Inverted);96}97}98
99#endregion // Public Methods100}101}
102