SimpleGauge.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. InitializeComponent();
  28. Value = 75;
  29. Scale = new SimpleScale(this);
  30. Pointer = new SimplePointer(this);
  31. Height = 2.0f * Units.Centimeters;
  32. Width = 8.0f * Units.Centimeters;
  33. }
  34. #endregion // Constructors
  35. #region Public Methods
  36. /// <inheritdoc/>
  37. public override void Draw(FRPaintEventArgs e)
  38. {
  39. base.Draw(e);
  40. Scale.Draw(e);
  41. Pointer.Draw(e);
  42. Border.Draw(e, new RectangleF(AbsLeft, AbsTop, Width, Height));
  43. IGraphics g = e.Graphics;
  44. if (Report != null && Report.SmoothGraphics)
  45. {
  46. g.InterpolationMode = InterpolationMode.HighQualityBicubic;
  47. g.SmoothingMode = SmoothingMode.AntiAlias;
  48. }
  49. Scale.Draw(e);
  50. Pointer.Draw(e);
  51. Border.Draw(e, new RectangleF(AbsLeft, AbsTop, Width, Height));
  52. }
  53. #endregion // Public Methods
  54. }
  55. }