GaugeObject.DesignExt.cs 990 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Windows.Forms;
  3. namespace FastReport.Gauge
  4. {
  5. public partial class GaugeObject : IHasEditor
  6. {
  7. /// <inheritdoc/>
  8. public override void OnBeforeInsert(int flags)
  9. {
  10. base.OnBeforeInsert(flags);
  11. // to avoid applying last formatting
  12. Border.Lines = BorderLines.All;
  13. }
  14. /// <inheritdoc/>
  15. public bool InvokeEditor()
  16. {
  17. return InvokeEditor(GetGaugeEditor);
  18. }
  19. internal virtual GaugeEditorForm GetGaugeEditor => throw new NotImplementedException();
  20. internal virtual bool InvokeEditor(GaugeEditorForm gaugeEditor)
  21. {
  22. var oldGauge = Clone();
  23. using (gaugeEditor)
  24. {
  25. if (gaugeEditor.ShowDialog() != DialogResult.OK)
  26. {
  27. this.Assign(oldGauge);
  28. return false;
  29. }
  30. }
  31. return true;
  32. }
  33. }
  34. }