DataBand.DesignExt.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System.Windows.Forms;
  2. using FastReport.Forms;
  3. using FastReport.Utils;
  4. namespace FastReport
  5. {
  6. partial class DataBand : IHasEditor
  7. {
  8. #region Private Methods
  9. private bool ShouldSerializeColumns()
  10. {
  11. return Columns.Count > 1;
  12. }
  13. #endregion
  14. #region Public Methods
  15. /// <inheritdoc/>
  16. public override void Delete()
  17. {
  18. if (!CanDelete)
  19. return;
  20. // remove only this band, keep its subbands
  21. if (Parent is ReportPage || Parent is DataBand)
  22. {
  23. Base parent = Parent;
  24. int zOrder = ZOrder;
  25. Parent = null;
  26. while (Bands.Count > 0)
  27. {
  28. BandBase band = Bands[Bands.Count - 1];
  29. band.Parent = parent;
  30. band.ZOrder = zOrder;
  31. }
  32. Dispose();
  33. }
  34. }
  35. /// <inheritdoc/>
  36. public override SmartTagBase GetSmartTag()
  37. {
  38. return new DataBandSmartTag(this);
  39. }
  40. /// <inheritdoc/>
  41. public override ContextMenuBase GetContextMenu()
  42. {
  43. return new DataBandMenu(Report.Designer);
  44. }
  45. internal override string GetInfoText()
  46. {
  47. return DataSource == null ? "" : DataSource.FullName;
  48. }
  49. /// <inheritdoc/>
  50. public bool InvokeEditor()
  51. {
  52. using (DataBandEditorForm form = new DataBandEditorForm(this))
  53. {
  54. return form.ShowDialog() == DialogResult.OK;
  55. }
  56. }
  57. /// <summary>
  58. /// Invokes column editor
  59. /// </summary>
  60. public bool InvokeColumnsEditor()
  61. {
  62. using (DataBandColumnEditorForm form = new DataBandColumnEditorForm(this.Columns))
  63. {
  64. return form.ShowDialog() == DialogResult.OK;
  65. }
  66. }
  67. #endregion
  68. }
  69. }