FRXPageOptions.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System.Windows.Forms;
  2. using FastReport.Utils;
  3. using FastReport.Design.PageDesigners.Code;
  4. namespace FastReport.Forms
  5. {
  6. internal class FRXPageOptions : DesignerOptionsPage
  7. {
  8. private FRXPageDesigner editor;
  9. private NumericUpDown udTabSize;
  10. private Label lblTabSize;
  11. private CheckBox cbUseSpaces;
  12. private CheckBox cbEnableFRXPage;
  13. private void InitializeComponent()
  14. {
  15. this.cbUseSpaces = new CheckBox();
  16. this.udTabSize = new NumericUpDown();
  17. this.lblTabSize = new Label();
  18. this.cbEnableFRXPage = new CheckBox();
  19. this.tc1.SuspendLayout();
  20. this.tab1.SuspendLayout();
  21. ((System.ComponentModel.ISupportInitialize)(this.udTabSize)).BeginInit();
  22. this.SuspendLayout();
  23. //
  24. // tab1
  25. //
  26. this.tab1.Controls.Add(this.udTabSize);
  27. this.tab1.Controls.Add(this.lblTabSize);
  28. this.tab1.Controls.Add(this.cbUseSpaces);
  29. this.tab1.Controls.Add(this.cbEnableFRXPage);
  30. //
  31. // cbEnableFRXPage
  32. //
  33. this.cbEnableFRXPage.AutoSize = true;
  34. this.cbEnableFRXPage.Location = new System.Drawing.Point(16, 16);
  35. this.cbEnableFRXPage.Name = "cbEnableFRXPage";
  36. this.cbEnableFRXPage.Size = new System.Drawing.Size(130, 17);
  37. this.cbEnableFRXPage.TabIndex = 1;
  38. this.cbEnableFRXPage.Text = "Enable";
  39. this.cbEnableFRXPage.UseVisualStyleBackColor = true;
  40. //
  41. // cbUseSpaces
  42. //
  43. this.cbUseSpaces.AutoSize = true;
  44. this.cbUseSpaces.Location = new System.Drawing.Point(16, 40);
  45. this.cbUseSpaces.Name = "cbUseSpaces";
  46. this.cbUseSpaces.Size = new System.Drawing.Size(130, 17);
  47. this.cbUseSpaces.TabIndex = 1;
  48. this.cbUseSpaces.Text = "Use spaces to fill tabs";
  49. this.cbUseSpaces.UseVisualStyleBackColor = true;
  50. //
  51. // udTabSize
  52. //
  53. this.udTabSize.Location = new System.Drawing.Point(199, 64);
  54. this.udTabSize.Maximum = new decimal(new int[] {
  55. 16,
  56. 0,
  57. 0,
  58. 0});
  59. this.udTabSize.Minimum = new decimal(new int[] {
  60. 1,
  61. 0,
  62. 0,
  63. 0});
  64. this.udTabSize.Name = "udTabSize";
  65. this.udTabSize.Size = new System.Drawing.Size(76, 21);
  66. this.udTabSize.TabIndex = 5;
  67. this.udTabSize.Value = new decimal(new int[] {
  68. 1,
  69. 0,
  70. 0,
  71. 0});
  72. //
  73. // lblTabSize
  74. //
  75. this.lblTabSize.AutoSize = true;
  76. this.lblTabSize.Location = new System.Drawing.Point(16, 66);
  77. this.lblTabSize.Name = "lblTabSize";
  78. this.lblTabSize.Size = new System.Drawing.Size(50, 13);
  79. this.lblTabSize.TabIndex = 4;
  80. this.lblTabSize.Text = "Tab size:";
  81. //
  82. // CodePageOptions
  83. //
  84. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  85. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
  86. this.ClientSize = new System.Drawing.Size(389, 313);
  87. this.Name = "FRXPageOptions";
  88. this.tc1.ResumeLayout(false);
  89. this.tab1.ResumeLayout(false);
  90. this.tab1.PerformLayout();
  91. ((System.ComponentModel.ISupportInitialize)(this.udTabSize)).EndInit();
  92. this.ResumeLayout(false);
  93. this.PerformLayout();
  94. }
  95. public void Localize()
  96. {
  97. MyRes res = new MyRes("Forms,CodePageOptions");
  98. tab1.Text = Res.Get("Forms,FRXPageOptions");
  99. cbEnableFRXPage.Text = Res.Get("Forms,FRXPageOptions,Enable");
  100. cbUseSpaces.Text = res.Get("UseSpaces");
  101. lblTabSize.Text = res.Get("TabSize");
  102. }
  103. public override void Init()
  104. {
  105. cbUseSpaces.Checked = FRXPageSettings.UseSpaces;
  106. udTabSize.Value = FRXPageSettings.TabSize;
  107. cbEnableFRXPage.Checked = FRXPageSettings.Enable;
  108. }
  109. public override void Done(DialogResult result)
  110. {
  111. if (result == DialogResult.OK)
  112. {
  113. FRXPageSettings.UseSpaces = cbUseSpaces.Checked;
  114. FRXPageSettings.Enable = cbEnableFRXPage.Checked;
  115. FRXPageSettings.TabSize = (int)udTabSize.Value;
  116. editor.UpdateOptions();
  117. editor.Designer.ActiveReportTab.InitPages(editor.Designer.ActiveReportTab.ActivePageIndex);
  118. }
  119. }
  120. public FRXPageOptions(FRXPageDesigner editor) : base()
  121. {
  122. this.editor = editor;
  123. InitializeComponent();
  124. Localize();
  125. }
  126. }
  127. }