SubreportObject.DesignExt.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System.ComponentModel;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. using FastReport.Utils;
  5. namespace FastReport
  6. {
  7. partial class SubreportObject
  8. {
  9. #region Properties
  10. /// <summary>
  11. /// This property is not relevant to this class.
  12. /// </summary>
  13. [Browsable(false)]
  14. public new bool Printable
  15. {
  16. get { return base.Printable; }
  17. }
  18. /// <summary>
  19. /// This property is not relevant to this class.
  20. /// </summary>
  21. [Browsable(false)]
  22. public new bool Exportable
  23. {
  24. get { return base.Exportable; }
  25. }
  26. /// <summary>
  27. /// This property is not relevant to this class.
  28. /// </summary>
  29. [Browsable(false)]
  30. public override Border Border
  31. {
  32. get { return base.Border; }
  33. set { base.Border = value; }
  34. }
  35. /// <summary>
  36. /// This property is not relevant to this class.
  37. /// </summary>
  38. [Browsable(false)]
  39. public override FillBase Fill
  40. {
  41. get { return base.Fill; }
  42. set { base.Fill = value; }
  43. }
  44. /// <summary>
  45. /// This property is not relevant to this class.
  46. /// </summary>
  47. [Browsable(false)]
  48. public new Cursor Cursor
  49. {
  50. get { return base.Cursor; }
  51. }
  52. /// <summary>
  53. /// This property is not relevant to this class.
  54. /// </summary>
  55. [Browsable(false)]
  56. public new Hyperlink Hyperlink
  57. {
  58. get { return base.Hyperlink; }
  59. }
  60. /// <summary>
  61. /// This property is not relevant to this class.
  62. /// </summary>
  63. [Browsable(false)]
  64. public new bool CanGrow
  65. {
  66. get { return base.CanGrow; }
  67. }
  68. /// <summary>
  69. /// This property is not relevant to this class.
  70. /// </summary>
  71. [Browsable(false)]
  72. public new bool CanShrink
  73. {
  74. get { return base.CanShrink; }
  75. }
  76. /// <summary>
  77. /// This property is not relevant to this class.
  78. /// </summary>
  79. [Browsable(false)]
  80. public new string Style
  81. {
  82. get { return base.Style; }
  83. }
  84. /// <summary>
  85. /// This property is not relevant to this class.
  86. /// </summary>
  87. [Browsable(false)]
  88. public new string BeforePrintEvent
  89. {
  90. get { return base.BeforePrintEvent; }
  91. }
  92. /// <summary>
  93. /// This property is not relevant to this class.
  94. /// </summary>
  95. [Browsable(false)]
  96. public new string AfterPrintEvent
  97. {
  98. get { return base.AfterPrintEvent; }
  99. }
  100. /// <summary>
  101. /// This property is not relevant to this class.
  102. /// </summary>
  103. [Browsable(false)]
  104. public new string ClickEvent
  105. {
  106. get { return base.ClickEvent; }
  107. }
  108. #endregion
  109. #region Public Methods
  110. /// <inheritdoc/>
  111. public override void Draw(FRPaintEventArgs e)
  112. {
  113. base.Draw(e);
  114. e.Graphics.DrawImage(Report.Designer.GetImage(104), (int)(AbsLeft * e.ScaleX) + 2, (int)(AbsTop * e.ScaleY) + 2);
  115. TextRenderer.DrawText(e.Graphics.Graphics, Name,
  116. e.Cache.GetFont(DrawUtils.DefaultFont.FontFamily, 8 * e.ScaleX * 96 / DrawUtils.ScreenDpi, FontStyle.Regular),
  117. new Rectangle((int)((AbsLeft + 20) * e.ScaleX), (int)((AbsTop + 2) * e.ScaleY), (int)((Width - 20) * e.ScaleX), (int)((Height - 2) * e.ScaleY)),
  118. Color.Black,
  119. TextFormatFlags.PreserveGraphicsTranslateTransform);
  120. DrawMarkers(e);
  121. }
  122. /// <inheritdoc/>
  123. public override void SetName(string value)
  124. {
  125. base.SetName(value);
  126. if (IsDesigning && ReportPage != null)
  127. {
  128. ReportPage.PageName = Name;
  129. Report.Designer.InitPages(Report.Pages.IndexOf(Page) + 1);
  130. }
  131. }
  132. /// <inheritdoc/>
  133. public override void OnAfterInsert(InsertFrom source)
  134. {
  135. ReportPage = new ReportPage();
  136. Report.Pages.Add(ReportPage);
  137. ReportPage.SetDefaults();
  138. ReportPage.ReportTitle.Dispose();
  139. ReportPage.PageHeader.Dispose();
  140. ReportPage.PageFooter.Dispose();
  141. ReportPage.CreateUniqueName();
  142. reportPage.PageName = Name;
  143. Report.Designer.InitPages(Report.Pages.Count);
  144. }
  145. /// <inheritdoc/>
  146. public override void Delete()
  147. {
  148. if (ReportPage != null)
  149. {
  150. RemoveSubReport(true);
  151. if (Report != null)
  152. Report.Designer.InitPages(Report.Pages.IndexOf(Page) + 1);
  153. }
  154. ReportPage = null;
  155. base.Delete();
  156. }
  157. /// <inheritdoc/>
  158. public override ContextMenuBase GetContextMenu()
  159. {
  160. return new SubreportObjectMenu(Report.Designer);
  161. }
  162. #endregion
  163. /// <inheritdoc/>
  164. public override void HandleDoubleClick()
  165. {
  166. if (ReportPage != null)
  167. Report.Designer.ActiveReportTab.ActivePage = ReportPage;
  168. }
  169. }
  170. }