GroupHeaderBand.DesignExt.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections;
  3. using System.Windows.Forms;
  4. using System.Drawing;
  5. using System.ComponentModel;
  6. using System.Drawing.Drawing2D;
  7. using System.Drawing.Design;
  8. using FastReport.Utils;
  9. using FastReport.Forms;
  10. using FastReport.Data;
  11. using FastReport.TypeEditors;
  12. namespace FastReport
  13. {
  14. partial class GroupHeaderBand : IHasEditor
  15. {
  16. #region Public Methods
  17. /// <inheritdoc/>
  18. public override void Delete()
  19. {
  20. if (!CanDelete)
  21. return;
  22. // remove only this band, keep its subbands
  23. BandBase nextBand = null;
  24. if (NestedGroup != null)
  25. nextBand = NestedGroup;
  26. else if (Data != null)
  27. nextBand = Data;
  28. nextBand.Parent = null;
  29. Base parent = Parent;
  30. int zOrder = ZOrder;
  31. Dispose();
  32. nextBand.Parent = parent;
  33. nextBand.ZOrder = zOrder;
  34. }
  35. internal override string GetInfoText()
  36. {
  37. string condition = Condition;
  38. condition = condition.Replace("[", "");
  39. condition = condition.Replace("]", "");
  40. if (DataHelper.IsValidColumn(Report.Dictionary, condition))
  41. {
  42. string[] parts = condition.Split('.');
  43. return parts[parts.Length - 1];
  44. }
  45. return Condition;
  46. }
  47. /// <inheritdoc/>
  48. public bool InvokeEditor()
  49. {
  50. using (GroupBandEditorForm form = new GroupBandEditorForm(this))
  51. {
  52. return form.ShowDialog() == DialogResult.OK;
  53. }
  54. }
  55. /// <inheritdoc/>
  56. public override ContextMenuBase GetContextMenu()
  57. {
  58. return new GroupHeaderBandMenu(Report.Designer);
  59. }
  60. #endregion
  61. }
  62. }