123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- using FastReport.Controls;
- using FastReport.Utils;
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- namespace FastReport.Gauge.Radial
- {
- internal partial class RadialGaugeEditorForm : GaugeEditorForm
- {
- #region Fields
- private Label lblType;
- private FlagsControl flagsControlType;
- private Label lblPosition;
- private FlagsControl flagsControlPosition;
- #endregion // Fields
- #region Constructors
- public RadialGaugeEditorForm(GaugeObject gauge) : base(gauge)
- {
- InitializeComponent();
- Localize();
- UIUtils.CheckRTL(this);
- UpdateDpiDependencies();
- }
- #endregion //Constructors
- #region ProtectedMethods
- /// <inheritdoc />
- protected override void Init()
- {
- base.Init();
- #region ControlsDesign
- if (Gauge != null)
- {
- try
- {
- lblType = new Label();
- flagsControlType = new FlagsControl();
- lblPosition = new Label();
- flagsControlPosition = new FlagsControl();
- int margin = 5;
- lblType.AutoSize = true;
- lblType.Margin = new Padding(margin);
- lblType.Location = new Point(btnGeneralBorder.Location.X, btnGeneralBorder.Location.Y + btnGeneralBorder.Size.Height + margin * 2);
- lblType.Name = "lblType";
- lblType.Text = "Type :";
- flagsControlType.AllowMultipleFlags = false;
- flagsControlType.BorderStyle = BorderStyle.FixedSingle;
- flagsControlType.Margin = new Padding(margin);
- flagsControlType.Location = new Point(btnGeneralFill.Location.X, lblType.Location.Y);
- flagsControlType.Name = "flagsControlType";
- flagsControlType.Flags = (Gauge as RadialGauge).Type;
- flagsControlType.Size = new Size(btnGeneralFill.Width, 65);
- lblPosition.AutoSize = true;
- lblPosition.Margin = new Padding(margin);
- lblPosition.Location = new Point(lblType.Location.X, flagsControlType.Location.Y + flagsControlType.Size.Height + margin * 2);
- lblPosition.Name = "lblPosition";
- lblPosition.Text = "Position :";
- flagsControlPosition.BorderStyle = BorderStyle.FixedSingle;
- flagsControlPosition.Margin = new Padding(margin);
- flagsControlPosition.Location = new Point(flagsControlType.Location.X, lblPosition.Location.Y);
- flagsControlPosition.Name = "flagsControlType";
- flagsControlPosition.Flags = (Gauge as RadialGauge).Position;
- flagsControlPosition.Size = new Size(btnGeneralFill.Width, 85);
- pgGeneral.Controls.AddRange(new Control[] { lblType, flagsControlType, lblPosition, flagsControlPosition });
- }
- catch (Exception ex)
- {
- if (!Config.WebMode)
- {
- FRMessageBox.Error(ex.Message);
- }
- }
- }
- #endregion // ControlsDesign
- }
- /// <inheritdoc />
- protected override void GaugeEditorForm_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (this.DialogResult == DialogResult.OK)
- {
- base.GaugeEditorForm_FormClosing(sender, e);
- try
- {
- (Gauge as RadialGauge).Type = (RadialGaugeType)flagsControlType.Flags;
- (Gauge as RadialGauge).Position = (RadialGaugePosition)flagsControlPosition.Flags;
- }
- catch (Exception ex)
- {
- if (!Config.WebMode)
- {
- FRMessageBox.Error(ex.Message);
- }
- }
- }
- }
- #endregion // Protected Methods
- public override void Localize()
- {
- base.Localize();
- MyRes res = new MyRes("Objects,Gauge,GaugeForms,RadialGauge");
- Text = res.Get("");
- res = new MyRes("Objects,Gauge,GaugeForms,PageGeneral");
- lblType.Text = res.Get("Type");
- lblPosition.Text = res.Get("Position");
- }
- }
- }
|