PageBase.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using FastReport.Utils;
  5. namespace FastReport
  6. {
  7. /// <summary>
  8. /// Base class for report pages and dialog forms.
  9. /// </summary>
  10. public abstract partial class PageBase : ComponentBase
  11. {
  12. #region Fields
  13. private string pageName;
  14. private bool needRefresh;
  15. private bool needModify;
  16. #endregion
  17. #region Properties
  18. internal string PageName
  19. {
  20. get
  21. {
  22. if (!String.IsNullOrEmpty(pageName))
  23. return pageName;
  24. return Name;
  25. //string pageName = Name;
  26. //if (pageName.StartsWith(BaseName))
  27. // pageName = pageName.Replace(BaseName, Res.Get("Objects," + ClassName));
  28. //return pageName;
  29. }
  30. set { pageName = value; }
  31. }
  32. internal bool NeedRefresh
  33. {
  34. get { return needRefresh; }
  35. set { needRefresh = value; }
  36. }
  37. internal bool NeedModify
  38. {
  39. get { return needModify; }
  40. set { needModify = value; }
  41. }
  42. #endregion
  43. #region Public Methods
  44. /// <summary>
  45. /// Causes the page to refresh in the preview window.
  46. /// </summary>
  47. /// <remarks>
  48. /// Call this method when you handle object's MouseMove, MouseDown, MouseUp, MouseEnter, MouseLeave events
  49. /// and want to refresh the preview window.
  50. /// <note type="caution">
  51. /// If you have changed some objects on a page, the <b>Refresh</b> method will not save the changes.
  52. /// This means when you print or export the page, you will see original (unmodified) page content.
  53. /// If you want to save the changes, you have to use the <see cref="Modify"/> method instead.
  54. /// </note>
  55. /// </remarks>
  56. public void Refresh()
  57. {
  58. needRefresh = true;
  59. }
  60. /// <summary>
  61. /// Modifies the page content and refresh it in the preview window.
  62. /// </summary>
  63. /// <remarks>
  64. /// Call this method when you handle object's Click, MouseDown or MouseUp events
  65. /// and want to modify an object and refresh the preview window.
  66. /// </remarks>
  67. public void Modify()
  68. {
  69. needModify = true;
  70. needRefresh = true;
  71. }
  72. #endregion
  73. /// <summary>
  74. /// Initializes a new instance of the <see cref="PageBase"/> class with default settings.
  75. /// </summary>
  76. public PageBase()
  77. {
  78. SetFlags(Flags.CanMove | Flags.CanResize | Flags.CanDelete | Flags.CanChangeOrder |
  79. Flags.CanChangeParent | Flags.CanCopy, false);
  80. }
  81. }
  82. }