GaugeObject.DesignExt.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Windows.Forms;
  2. namespace FastReport.Gauge
  3. {
  4. public partial class GaugeObject : IHasEditor
  5. {
  6. /// <inheritdoc/>
  7. public override void OnBeforeInsert(int flags)
  8. {
  9. base.OnBeforeInsert(flags);
  10. // to avoid applying last formatting
  11. Border.Lines = BorderLines.All;
  12. }
  13. /// <inheritdoc />
  14. public virtual bool InvokeEditor()
  15. {
  16. using (GaugeEditorForm gaugeEditor = new GaugeEditorForm(this))
  17. {
  18. return InvokeEditor(gaugeEditor);
  19. }
  20. }
  21. /// <inheritdoc />
  22. internal virtual bool InvokeEditor(GaugeEditorForm gaugeEditor)
  23. {
  24. GaugeObject oldGauge = (GaugeObject)Clone();
  25. using (gaugeEditor)
  26. {
  27. if (gaugeEditor.ShowDialog() != DialogResult.OK)
  28. {
  29. Scale = oldGauge.Scale;
  30. Pointer = oldGauge.Pointer;
  31. Label = oldGauge.Label;
  32. Fill = oldGauge.Fill;
  33. }
  34. else
  35. Report.Designer.SetModified(this, "Change");
  36. }
  37. return true;
  38. }
  39. }
  40. }