SimpleGauge.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Drawing;
  2. using System.Drawing.Drawing2D;
  3. using FastReport.Utils;
  4. using System.ComponentModel;
  5. namespace FastReport.Gauge.Simple
  6. {
  7. /// <summary>
  8. /// Represents a simple gauge.
  9. /// </summary>
  10. public partial class SimpleGauge : GaugeObject
  11. {
  12. /// <summary>
  13. /// Gets or sets gauge label.
  14. /// </summary>
  15. [Browsable(false)]
  16. public override GaugeLabel Label
  17. {
  18. get { return base.Label; }
  19. set { base.Label = value; }
  20. }
  21. #region Constructors
  22. /// <summary>
  23. /// Initializes a new instance of the <see cref="SimpleGauge"/> class.
  24. /// </summary>
  25. public SimpleGauge() : base()
  26. {
  27. Value = 75;
  28. Scale = new SimpleScale(this);
  29. Pointer = new SimplePointer(this);
  30. Height = 2.0f * Units.Centimeters;
  31. Width = 8.0f * Units.Centimeters;
  32. }
  33. #endregion // Constructors
  34. #region Public Methods
  35. /// <inheritdoc/>
  36. public override void Draw(FRPaintEventArgs e)
  37. {
  38. base.Draw(e);
  39. Scale.Draw(e);
  40. Pointer.Draw(e);
  41. Border.Draw(e, new RectangleF(AbsLeft, AbsTop, Width, Height));
  42. IGraphics g = e.Graphics;
  43. if (Report != null && Report.SmoothGraphics)
  44. {
  45. g.InterpolationMode = InterpolationMode.HighQualityBicubic;
  46. g.SmoothingMode = SmoothingMode.AntiAlias;
  47. }
  48. Scale.Draw(e);
  49. Pointer.Draw(e);
  50. Border.Draw(e, new RectangleF(AbsLeft, AbsTop, Width, Height));
  51. }
  52. #endregion // Public Methods
  53. }
  54. }