private void NewLot_Click(object sender, EventArgs e) { string text = (sender as Button).Text; string lum = ""; if (text == "Нов ЛОТ") lum = "ЛОТ "; else lum = "Осв. тяло "; LumList.Items.Add(lum + System.Convert.ToInt32(StickNum.Value) + "x" + System.Convert.ToInt32(Power.Value) + "W"); LumList.Items.Add(""); InstallationItem newIt = new InstallationItem { Name = LumList.Items[LumList.Items.Count - 1].ToString(), Id = 4000 + LumList.Items.Count, Type = (InstallationType)1 }; Main.Stats.Items.Add(newIt); int ind = LumList.Items.Count / 2 - 1; TextBox num = new TextBox { Name = "Lum" + LumList.Items.Count, Size = MonoPhase.Size, Top = ind * 26, Left = 2, Multiline = true, Text = "0", Visible = true }; num.TextChanged += new EventHandler(rows_TextChanged); Rows.Controls.Add(num); ComboBox pro = new ComboBox { Top = ind * 26, Left = 2, Size = MonoPhase.Size, Visible = true }; foreach (Protectors p in Main.Stats.Protectors) pro.Items.Add(p.Name); pro.SelectedIndexChanged += new EventHandler(DefPro_SelectedIndexChanged); LumAmp.Controls.Add(pro); }
private void NewLot_Click(object sender, EventArgs e) { string text = (sender as Button).Text; string lum = ""; if (text == "Нов ЛОТ") lum = "ЛОТ "; else lum = "Осв. тяло "; LumList.Items.Add(lum + System.Convert.ToInt32(StickNum.Value) + "x" + System.Convert.ToInt32(Power.Value) + "W"); LumList.Items.Add(""); InstallationItem newIt = new InstallationItem { Name = LumList.Items[LumList.Items.Count - 1].ToString(), Id = 4000 + LumList.Items.Count, Type = (InstallationType)1 }; Main.Stats.Items.Add(newIt); int ind = LumList.Items.Count/2 - 1; TextBox num = new TextBox { Name = "Lum" + LumList.Items.Count, Size = MonoPhase.Size, Top = ind * 26, Left = 2, Multiline = true, Text = "0", Visible = true }; num.TextChanged += new EventHandler(rows_TextChanged); Rows.Controls.Add(num); NumericUpDown amp = new NumericUpDown { Top = ind * 26, Left = 2, Size = MonoPhase.Size, Minimum = 4, Maximum = 500, Increment = 0.1M, Value = 25, DecimalPlaces = 0, Visible = true }; amp.ValueChanged += new EventHandler(Amperage_ValueChanged); LumAmp.Controls.Add(amp); GroupBox gr = new GroupBox { Top = ind * 26, Left = 2, Size = groupBox8.Size, Visible = true }; LumIsAuto.Controls.Add(gr); RadioButton rad1 = new RadioButton { Top = 0, Left = 2, AutoSize = true, Text = "Автоматичен прекъсвач", Visible = true, Checked = EL2Ref.isAuto }; rad1.CheckedChanged += new EventHandler(isAutoCheckedChanged); RadioButton rad2 = new RadioButton { Top = 0, Left = 156, AutoSize = true, Text = "Стопяем предпазител", Visible = true, Checked = !EL2Ref.isAuto }; gr.Controls.Add(rad1); gr.Controls.Add(rad2); }