using FastReport.Utils; using System; using System.Drawing; using System.Windows.Forms; namespace FastReport.Gauge.Simple.Progress { internal partial class SimpleProgressGaugeEditorForm : SimpleGaugeEditorForm { private Label lblDecimals; private TextBox tbDecimals; private Label lblPtrType; private ComboBox cbPtrType; #region Constructors public SimpleProgressGaugeEditorForm(GaugeObject gauge) : base(gauge, true) { InitializeComponent(); Localize(); UIUtils.CheckRTL(this); UpdateDpiDependencies(); } #endregion Constructors // Constructors #region ProtectedMethods protected override void Init() { base.Init(); #region ControlsDesign pageControl1.Pages.Remove(pgScale); tbLabelText.Visible = false; tbLabelText.Enabled = false; lblLabelText.Visible = false; lblDecimals = new Label(); tbDecimals = new TextBox(); lblPtrType = new Label(); cbPtrType = new ComboBox(); lblDecimals.AutoSize = true; lblDecimals.Location = lblLabelText.Location; lblDecimals.Name = "lblDecimals"; lblDecimals.Text = "Decimals :"; tbDecimals.Location = tbLabelText.Location; tbDecimals.Size = textBoxButtonLabelFont.Size; tbDecimals.Name = "tbDecimals"; lblPtrType.AutoSize = true; lblPtrType.Location = new Point(lblPtrBorderColor.Location.X, btnPointerFill.Location.Y + btnPointerFill.Height + 5); lblPtrType.Name = "lblPtrType"; lblPtrType.Text = "Type :"; cbPtrType.Size = btnPointerFill.Size; cbPtrType.DropDownStyle = ComboBoxStyle.DropDownList; cbPtrType.Location = new Point(btnPointerFill.Location.X, lblPtrType.Location.Y); cbPtrType.Items.Add("Full"); cbPtrType.Items.Add("Small"); cbPtrType.SelectedItem = "Full"; cbPtrType.Name = "cbPtrType"; pgLabel.Controls.AddRange(new Control[] { lblDecimals, tbDecimals }); pgPointer.Controls.AddRange(new Control[] { lblPtrType, cbPtrType }); #endregion // ControlsDesign if (Gauge != null) { try { tbDecimals.Text = Convert.ToString(((Gauge as SimpleProgressGauge).Label as SimpleProgressLabel).Decimals); cbPtrType.SelectedItem = ((Gauge as SimpleProgressGauge).Pointer as SimpleProgressPointer).Type == SimpleProgressPointerType.Full ? "Full" : "Small"; } catch (Exception ex) { if (!Config.WebMode) { FRMessageBox.Error(ex.Message); } } } } /// protected override void GaugeEditorForm_FormClosing(object sender, FormClosingEventArgs e) { if (this.DialogResult == DialogResult.OK) { base.GaugeEditorForm_FormClosing(sender, e); try { ((Gauge as SimpleProgressGauge).Label as SimpleProgressLabel).Decimals = int.Parse(tbDecimals.Text); ((Gauge as SimpleProgressGauge).Pointer as SimpleProgressPointer).Type = cbPtrType.SelectedItem.ToString() == "Full" ? SimpleProgressPointerType.Full : SimpleProgressPointerType.Small; } 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,SimpleProgressGauge"); Text = res.Get(""); res = new MyRes("Objects,Gauge,GaugeForms,PagePointer"); lblPtrType.Text = res.Get("LabelPointerType"); res = new MyRes("Objects,Gauge,GaugeForms,PageLabel"); lblDecimals.Text = res.Get("Decimals"); } } }