DesignerOptionsPage.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. using System;
  2. using System.Windows.Forms;
  3. namespace FastReport.Forms
  4. {
  5. /// <summary>
  6. /// The base class for designer plugin's options page.
  7. /// </summary>
  8. /// <remarks>
  9. /// Use this class if you develop a designer plugin that may be configured in the
  10. /// "View|Options..." menu. You need to implement an options page for your
  11. /// plugin and return it in the <b>IDesignerPlugin.GetOptionsPage</b> method.
  12. /// </remarks>
  13. public class DesignerOptionsPage : Form
  14. {
  15. private Label lblWarn;
  16. private bool restartRequired;
  17. /// <summary>
  18. /// The <b>TabControl</b> control.
  19. /// </summary>
  20. public TabControl tc1;
  21. /// <summary>
  22. /// The <b>TabPage</b> control.
  23. /// </summary>
  24. public TabPage tab1;
  25. /// <summary>
  26. /// Gets or sets a value indicating that restart is required.
  27. /// </summary>
  28. public bool RestartRequired
  29. {
  30. get => restartRequired;
  31. set
  32. {
  33. restartRequired = value;
  34. RestartRequiredChanged?.Invoke(this, EventArgs.Empty);
  35. }
  36. }
  37. /// <summary>
  38. /// Event is fired whenever the RestartRequired property is changed.
  39. /// </summary>
  40. public event EventHandler RestartRequiredChanged;
  41. private void InitializeComponent()
  42. {
  43. this.tc1 = new System.Windows.Forms.TabControl();
  44. this.tab1 = new System.Windows.Forms.TabPage();
  45. this.lblWarn = new System.Windows.Forms.Label();
  46. this.tc1.SuspendLayout();
  47. this.SuspendLayout();
  48. //
  49. // tc1
  50. //
  51. this.tc1.Controls.Add(this.tab1);
  52. this.tc1.Location = new System.Drawing.Point(12, 12);
  53. this.tc1.Name = "tc1";
  54. this.tc1.SelectedIndex = 0;
  55. this.tc1.Size = new System.Drawing.Size(376, 276);
  56. this.tc1.TabIndex = 0;
  57. //
  58. // tab1
  59. //
  60. this.tab1.Location = new System.Drawing.Point(4, 22);
  61. this.tab1.Name = "tab1";
  62. this.tab1.Padding = new System.Windows.Forms.Padding(3);
  63. this.tab1.Size = new System.Drawing.Size(368, 250);
  64. this.tab1.TabIndex = 0;
  65. this.tab1.Text = "tabPage1";
  66. this.tab1.UseVisualStyleBackColor = true;
  67. //
  68. // lblWarn
  69. //
  70. this.lblWarn.AutoSize = true;
  71. this.lblWarn.Location = new System.Drawing.Point(8, 300);
  72. this.lblWarn.Name = "lblWarn";
  73. this.lblWarn.Size = new System.Drawing.Size(328, 13);
  74. this.lblWarn.TabIndex = 1;
  75. this.lblWarn.Text = "Place your controls on tab page only! Add new pages if necessary.";
  76. //
  77. // DesignerOptionsPage
  78. //
  79. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  80. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
  81. this.ClientSize = new System.Drawing.Size(398, 323);
  82. this.Controls.Add(this.lblWarn);
  83. this.Controls.Add(this.tc1);
  84. this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  85. this.Name = "DesignerOptionsPage";
  86. this.tc1.ResumeLayout(false);
  87. this.ResumeLayout(false);
  88. this.PerformLayout();
  89. }
  90. /// <summary>
  91. /// Initializes controls on this options page.
  92. /// </summary>
  93. /// <remarks>
  94. /// Override this method to fill options page's controls with initial values.
  95. /// </remarks>
  96. public virtual void Init()
  97. {
  98. }
  99. /// <summary>
  100. /// Finalizes the options page.
  101. /// </summary>
  102. /// <param name="result">The dialog result.</param>
  103. /// <remarks>
  104. /// Override this method to pass controls' values to the plugin. Do this if <b>result</b> is
  105. /// <b>DialogResult.OK</b>.
  106. /// </remarks>
  107. public virtual void Done(DialogResult result)
  108. {
  109. }
  110. /// <summary>
  111. /// Updates images used in the control.
  112. /// </summary>
  113. public virtual void UpdateDpiDependencies()
  114. {
  115. }
  116. /// <summary>
  117. /// Initializes a new instance of the <b>DesignerOptionsPage</b> class with default settings.
  118. /// </summary>
  119. /// <remarks>
  120. /// Usually you need to define another contructor which takes one parameter - the plugin.
  121. /// </remarks>
  122. /// <example>This example shows how to define own constructor which takes a plugin:
  123. /// <code>
  124. /// public DialogPageOptions(DialogPageDesigner pd) : base()
  125. /// {
  126. /// FPageDesigner = pd;
  127. /// InitializeComponent();
  128. /// }
  129. /// </code>
  130. /// </example>
  131. public DesignerOptionsPage()
  132. {
  133. InitializeComponent();
  134. }
  135. }
  136. }