using System; using System.Drawing; using System.Windows.Forms; using FastReport.Gauge.Simple.Progress; using FastReport.Utils; namespace FastReport.Gauge.Simple { internal partial class SimpleGaugeEditorForm : GaugeEditorForm { #region Fields private GroupBox gpBoxFirstSubScale; private GroupBox gpBoxSecondSubScale; private TabPage tpSubscales; private ComboBox cbEnabled1; private Label lbEnabled1; private Label lbShowCaption1; private ComboBox cbShowCaption1; private ComboBox cbEnabled2; private Label lbEnabled2; private Label lbShowCaption2; private ComboBox cbShowCaption2; #endregion Fields // Fields #region Constructors public SimpleGaugeEditorForm(GaugeObject gauge, bool intermediate = false) : base(gauge) { if (!intermediate) { InitializeComponent(); Localize(); UIUtils.CheckRTL(this); UpdateDpiDependencies(); } } #endregion Constructors // Constructors #region ProtectedMethods protected override void Init() { DeleteLabel = Gauge is SimpleProgressGauge ? false : true; base.Init(); #region ControlsDesign gpBoxFirstSubScale = new GroupBox(); gpBoxSecondSubScale = new GroupBox(); lbEnabled1 = new Label(); cbEnabled1 = new ComboBox(); lbShowCaption1 = new Label(); cbShowCaption1 = new ComboBox(); lbEnabled2 = new Label(); cbEnabled2 = new ComboBox(); lbShowCaption2 = new Label(); cbShowCaption2 = new ComboBox(); int margin = 5; //first subscale gpBoxFirstSubScale.Location = new System.Drawing.Point(8, 9); gpBoxFirstSubScale.Name = "gpBoxFirstSubScale"; gpBoxFirstSubScale.Margin = new Padding(10); gpBoxFirstSubScale.AutoSize = false; gpBoxFirstSubScale.Size = new Size(269, 83); gpBoxFirstSubScale.TabStop = false; gpBoxFirstSubScale.Text = "First Subscale"; lbEnabled1.AutoSize = true; lbEnabled1.Margin = new Padding(margin); lbEnabled1.Location = new Point(11, 23); lbEnabled1.Name = "lbEnabled"; lbEnabled1.Text = "Enabled :"; cbEnabled1.DropDownStyle = ComboBoxStyle.DropDownList; cbEnabled1.Margin = new Padding(margin); cbEnabled1.Location = new Point(133, 21); cbEnabled1.Size = new Size(124, 21); cbEnabled1.Items.Add("true"); cbEnabled1.Items.Add("false"); cbEnabled1.SelectedItem = "false"; cbEnabled1.Name = "cbEnabled"; lbShowCaption1.AutoSize = true; lbShowCaption1.Margin = new Padding(margin); lbShowCaption1.Location = new Point(11, 49); lbShowCaption1.Name = "lbShowCaption"; lbShowCaption1.Text = "Show Caption:"; cbShowCaption1.DropDownStyle = ComboBoxStyle.DropDownList; cbShowCaption1.Margin = new Padding(margin); cbShowCaption1.Location = new Point(133, 46); cbShowCaption1.Size = new Size(124, 21); cbShowCaption1.Items.Add("true"); cbShowCaption1.Items.Add("false"); cbShowCaption1.SelectedItem = "false"; cbShowCaption1.Name = "cbInverted"; gpBoxFirstSubScale.Controls.AddRange(new Control[] { lbEnabled1, cbEnabled1, lbShowCaption1, cbShowCaption1 }); //second subscale gpBoxSecondSubScale.Location = new Point(gpBoxFirstSubScale.Location.X, gpBoxFirstSubScale.Location.Y + gpBoxFirstSubScale.Size.Height + 4); gpBoxSecondSubScale.Name = "gpBoxSecondSubScale"; gpBoxSecondSubScale.Margin = new Padding(10); gpBoxSecondSubScale.Size = new Size(269, 83); gpBoxSecondSubScale.TabStop = false; gpBoxSecondSubScale.Text = "Second Subscale"; lbEnabled2.AutoSize = true; lbEnabled2.Margin = new Padding(margin); lbEnabled2.Location = new Point(11, 23); lbEnabled2.Name = "lbEnabled"; lbEnabled2.Text = "Enabled :"; cbEnabled2.DropDownStyle = ComboBoxStyle.DropDownList; cbEnabled2.Margin = new Padding(margin); cbEnabled2.Location = new Point(133, 21); cbEnabled2.Size = new Size(124, 21); cbEnabled2.Items.Add("true"); cbEnabled2.Items.Add("false"); cbEnabled2.SelectedItem = "false"; cbEnabled2.Name = "cbEnabled"; lbShowCaption2 = new Label(); lbShowCaption2.AutoSize = true; lbShowCaption2.Margin = new Padding(margin); lbShowCaption2.Location = new Point(11, 49); lbShowCaption2.Name = "lbShowCaption"; lbShowCaption2.Text = "Show Caption:"; cbShowCaption2.DropDownStyle = ComboBoxStyle.DropDownList; cbShowCaption2.Margin = new Padding(margin); cbShowCaption2.Location = new Point(133, 46); cbShowCaption2.Size = new Size(124, 21); cbShowCaption2.Items.Add("true"); cbShowCaption2.Items.Add("false"); cbShowCaption2.SelectedItem = "false"; cbShowCaption2.Name = "cbInverted"; gpBoxSecondSubScale.Controls.AddRange(new Control[] { lbEnabled2, cbEnabled2, lbShowCaption2, cbShowCaption2 }); //tab page tpSubscales = new TabPage(); tpSubscales.Name = "tabPageSubscales"; tpSubscales.Size = new System.Drawing.Size(418, 525); tpSubscales.Text = "Subscales"; tpSubscales.UseVisualStyleBackColor = true; tpSubscales.Controls.AddRange(new Control[] { gpBoxFirstSubScale, gpBoxSecondSubScale }); tabControl3.TabPages.Add(tpSubscales); //tpSubscales.Scale(new SizeF(this.DpiMultiplier(), this.DpiMultiplier())); #endregion // ControlsDesign if (Gauge != null) { try { cbEnabled1.SelectedItem = ((Gauge as SimpleGauge).Scale as SimpleScale).FirstSubScale.Enabled ? "true" : "false"; cbShowCaption1.SelectedItem = ((Gauge as SimpleGauge).Scale as SimpleScale).FirstSubScale.ShowCaption ? "true" : "false"; cbEnabled2.SelectedItem = ((Gauge as SimpleGauge).Scale as SimpleScale).SecondSubScale.Enabled ? "true" : "false"; cbShowCaption2.SelectedItem = ((Gauge as SimpleGauge).Scale as SimpleScale).SecondSubScale.ShowCaption ? "true" : "false"; } 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 SimpleGauge).Scale as SimpleScale).FirstSubScale.Enabled = cbEnabled1.SelectedItem.ToString() == "false" ? false : true; ((Gauge as SimpleGauge).Scale as SimpleScale).FirstSubScale.ShowCaption = cbShowCaption1.SelectedItem.ToString() == "false" ? false : true; ((Gauge as SimpleGauge).Scale as SimpleScale).SecondSubScale.Enabled = cbEnabled2.SelectedItem.ToString() == "false" ? false : true; ((Gauge as SimpleGauge).Scale as SimpleScale).SecondSubScale.ShowCaption = cbShowCaption2.SelectedItem.ToString() == "false" ? false : true; } 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,SimpleGauge"); Text = res.Get(""); res = new MyRes("Objects,Gauge,GaugeForms,PageScale,Subscales"); tabControl3.TabPages[2].Text = res.Get(""); gpBoxFirstSubScale.Text = res.Get("FirstSubscale"); lbEnabled1.Text = res.Get("FirstSubscale,Enabled"); lbShowCaption1.Text = res.Get("FirstSubscale,ShowCaption"); gpBoxSecondSubScale.Text = res.Get("SecondSubscale"); lbEnabled2.Text = res.Get("SecondSubscale,Enabled"); lbShowCaption2.Text = res.Get("SecondSubscale,ShowCaption"); } } }