RadialGaugeEditorForm.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using FastReport.Controls;
  2. using FastReport.Utils;
  3. using System;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. namespace FastReport.Gauge.Radial
  7. {
  8. internal partial class RadialGaugeEditorForm : GaugeEditorForm
  9. {
  10. #region Fields
  11. private Label lblType;
  12. private FlagsControl flagsControlType;
  13. private Label lblPosition;
  14. private FlagsControl flagsControlPosition;
  15. #endregion // Fields
  16. #region Constructors
  17. public RadialGaugeEditorForm(GaugeObject gauge) : base(gauge)
  18. {
  19. InitializeComponent();
  20. Localize();
  21. UIUtils.CheckRTL(this);
  22. UpdateDpiDependencies();
  23. }
  24. #endregion //Constructors
  25. #region ProtectedMethods
  26. /// <inheritdoc />
  27. protected override void Init()
  28. {
  29. base.Init();
  30. #region ControlsDesign
  31. if (Gauge != null)
  32. {
  33. try
  34. {
  35. lblType = new Label();
  36. flagsControlType = new FlagsControl();
  37. lblPosition = new Label();
  38. flagsControlPosition = new FlagsControl();
  39. int margin = 5;
  40. lblType.AutoSize = true;
  41. lblType.Margin = new Padding(margin);
  42. lblType.Location = new Point(btnGeneralBorder.Location.X, btnGeneralBorder.Location.Y + btnGeneralBorder.Size.Height + margin * 2);
  43. lblType.Name = "lblType";
  44. lblType.Text = "Type :";
  45. flagsControlType.AllowMultipleFlags = false;
  46. flagsControlType.BorderStyle = BorderStyle.FixedSingle;
  47. flagsControlType.Margin = new Padding(margin);
  48. flagsControlType.Location = new Point(btnGeneralFill.Location.X, lblType.Location.Y);
  49. flagsControlType.Name = "flagsControlType";
  50. flagsControlType.Flags = (Gauge as RadialGauge).Type;
  51. flagsControlType.Size = new Size(btnGeneralFill.Width, 65);
  52. lblPosition.AutoSize = true;
  53. lblPosition.Margin = new Padding(margin);
  54. lblPosition.Location = new Point(lblType.Location.X, flagsControlType.Location.Y + flagsControlType.Size.Height + margin * 2);
  55. lblPosition.Name = "lblPosition";
  56. lblPosition.Text = "Position :";
  57. flagsControlPosition.BorderStyle = BorderStyle.FixedSingle;
  58. flagsControlPosition.Margin = new Padding(margin);
  59. flagsControlPosition.Location = new Point(flagsControlType.Location.X, lblPosition.Location.Y);
  60. flagsControlPosition.Name = "flagsControlType";
  61. flagsControlPosition.Flags = (Gauge as RadialGauge).Position;
  62. flagsControlPosition.Size = new Size(btnGeneralFill.Width, 85);
  63. pgGeneral.Controls.AddRange(new Control[] { lblType, flagsControlType, lblPosition, flagsControlPosition });
  64. }
  65. catch (Exception ex)
  66. {
  67. if (!Config.WebMode)
  68. {
  69. FRMessageBox.Error(ex.Message);
  70. }
  71. }
  72. }
  73. #endregion // ControlsDesign
  74. }
  75. /// <inheritdoc />
  76. protected override void GaugeEditorForm_FormClosing(object sender, FormClosingEventArgs e)
  77. {
  78. if (this.DialogResult == DialogResult.OK)
  79. {
  80. base.GaugeEditorForm_FormClosing(sender, e);
  81. try
  82. {
  83. (Gauge as RadialGauge).Type = (RadialGaugeType)flagsControlType.Flags;
  84. (Gauge as RadialGauge).Position = (RadialGaugePosition)flagsControlPosition.Flags;
  85. }
  86. catch (Exception ex)
  87. {
  88. if (!Config.WebMode)
  89. {
  90. FRMessageBox.Error(ex.Message);
  91. }
  92. }
  93. }
  94. }
  95. #endregion // Protected Methods
  96. public override void Localize()
  97. {
  98. base.Localize();
  99. MyRes res = new MyRes("Objects,Gauge,GaugeForms,RadialGauge");
  100. Text = res.Get("");
  101. res = new MyRes("Objects,Gauge,GaugeForms,PageGeneral");
  102. lblType.Text = res.Get("Type");
  103. lblPosition.Text = res.Get("Position");
  104. }
  105. }
  106. }