- Регистрация
- 28.03.2015
- Сообщения
- 532
- Благодарностей
- 171
- Баллы
- 43
Обращаем Ваше внимание на то, что данный пользователь заблокирован.
Не рекомендуем проводить с iskrakovrov какие-либо сделки.
Код:
System.Windows.Forms.Form Z = new System.Windows.Forms.Form();
Z.Text = "Сделайте выбор";
//создаем чекбоксы
System.Windows.Forms.CheckBox chbox1 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox2 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox3 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox4 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox5 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox6 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox7 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox8 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox9 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox10 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox11 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox12 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox13 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox14 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox15 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox16 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox17 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox18 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox19 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox20 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox21 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox22 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox23 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox24 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox25 = new System.Windows.Forms.CheckBox();
System.Windows.Forms.CheckBox chbox26 = new System.Windows.Forms.CheckBox();
//задаем имя чекбоксам
chbox1.Text = "Alabama";
chbox2.Text = "Alaska";
chbox3.Text = "Arizona";
chbox4.Text = "Arkansas";
chbox5.Text = "California";
chbox6.Text = "Colorado";
chbox7.Text = "Connecticut";
chbox8.Text = "Delaware";
chbox9.Text = "District of Columbia";
chbox10.Text = "Florida";
chbox11.Text = "Georgia";
chbox12.Text = "Hawaii";
chbox13.Text = "Idaho";
chbox14.Text = "Illinois";
chbox15.Text = "Indiana";
chbox16.Text = "Iowa";
chbox17.Text = "Kansas";
chbox18.Text = "Kentucky";
chbox19.Text = "Louisiana";
chbox20.Text = "Mainen";
chbox21.Text = "Maryland";
chbox22.Text = "Massachusetts";
chbox23.Text = "Michigan";
chbox24.Text = "Minnesota";
chbox25.Text = "Mississippi";
chbox26.Text = "Missouri";
//положение в окне
chbox1.Location = new System.Drawing.Point(10,30);
chbox2.Location = new System.Drawing.Point(10,60);
chbox3.Location = new System.Drawing.Point(10,90);
chbox4.Location = new System.Drawing.Point(10,120);
chbox5.Location = new System.Drawing.Point(10,150);
chbox6.Location = new System.Drawing.Point(10,180);
chbox7.Location = new System.Drawing.Point(10,210);
chbox8.Location = new System.Drawing.Point(10,240);
chbox9.Location = new System.Drawing.Point(10,270);
chbox10.Location = new System.Drawing.Point(10,300);
chbox11.Location = new System.Drawing.Point(10,330);
chbox12.Location = new System.Drawing.Point(10,360);
chbox13.Location = new System.Drawing.Point(10,390);
chbox14.Location = new System.Drawing.Point(10,420);
chbox15.Location = new System.Drawing.Point(10,450);
chbox16.Location = new System.Drawing.Point(10,480);
chbox17.Location = new System.Drawing.Point(10,510);
chbox18.Location = new System.Drawing.Point(10,540);
chbox19.Location = new System.Drawing.Point(10,570);
chbox20.Location = new System.Drawing.Point(10,600);
chbox21.Location = new System.Drawing.Point(10,630);
chbox22.Location = new System.Drawing.Point(10,660);
chbox23.Location = new System.Drawing.Point(10,690);
chbox24.Location = new System.Drawing.Point(10,720);
chbox25.Location = new System.Drawing.Point(10,750);
chbox26.Location = new System.Drawing.Point(10,780);
//кидаем на форму
Z.strols.Add(chbox1);
Z.strols.Add(chbox2);
Z.strols.Add(chbox3);
Z.strols.Add(chbox4);
Z.strols.Add(chbox5);
Z.strols.Add(chbox6);
Z.strols.Add(chbox7);
Z.strols.Add(chbox8);
Z.strols.Add(chbox9);
Z.strols.Add(chbox10);
Z.strols.Add(chbox11);
Z.strols.Add(chbox12);
Z.strols.Add(chbox13);
Z.strols.Add(chbox14);
Z.strols.Add(chbox15);
Z.strols.Add(chbox16);
Z.strols.Add(chbox17);
Z.strols.Add(chbox18);
Z.strols.Add(chbox19);
Z.strols.Add(chbox20);
Z.strols.Add(chbox21);
Z.strols.Add(chbox22);
Z.strols.Add(chbox23);
Z.strols.Add(chbox24);
Z.strols.Add(chbox25);
Z.strols.Add(chbox26);
//Устанавливаем отметки в нужные нам чекбоксы
bool flag;
//пробуем распознать текст как булеву переменную True или False
System.Boolean.TryParse(project.Variables["st1"].Value, out flag);
//устанавливаем результат нашего распознавания, если распознать не удалость, то False
chbox1.Checked=flag;
System.Boolean.TryParse(project.Variables["st2"].Value, out flag);
chbox2.Checked=flag;
System.Boolean.TryParse(project.Variables["st3"].Value, out flag);
chbox3.Checked=flag;
System.Boolean.TryParse(project.Variables["st4"].Value, out flag);
chbox4.Checked=flag;
System.Boolean.TryParse(project.Variables["st5"].Value, out flag);
chbox5.Checked=flag;
System.Boolean.TryParse(project.Variables["st6"].Value, out flag);
chbox6.Checked=flag;
System.Boolean.TryParse(project.Variables["st7"].Value, out flag);
chbox7.Checked=flag;
System.Boolean.TryParse(project.Variables["st8"].Value, out flag);
chbox8.Checked=flag;
System.Boolean.TryParse(project.Variables["st9"].Value, out flag);
chbox9.Checked=flag;
System.Boolean.TryParse(project.Variables["st10"].Value, out flag);
chbox10.Checked=flag;
System.Boolean.TryParse(project.Variables["st11"].Value, out flag);
chbox11.Checked=flag;
System.Boolean.TryParse(project.Variables["st12"].Value, out flag);
chbox12.Checked=flag;
System.Boolean.TryParse(project.Variables["st13"].Value, out flag);
chbox13.Checked=flag;
System.Boolean.TryParse(project.Variables["st14"].Value, out flag);
chbox14.Checked=flag;
System.Boolean.TryParse(project.Variables["st15"].Value, out flag);
chbox15.Checked=flag;
System.Boolean.TryParse(project.Variables["st16"].Value, out flag);
chbox16.Checked=flag;
System.Boolean.TryParse(project.Variables["st17"].Value, out flag);
chbox17.Checked=flag;
System.Boolean.TryParse(project.Variables["st18"].Value, out flag);
chbox18.Checked=flag;
System.Boolean.TryParse(project.Variables["st19"].Value, out flag);
chbox19.Checked=flag;
System.Boolean.TryParse(project.Variables["st20"].Value, out flag);
chbox20.Checked=flag;
System.Boolean.TryParse(project.Variables["st21"].Value, out flag);
chbox21.Checked=flag;
System.Boolean.TryParse(project.Variables["st22"].Value, out flag);
chbox22.Checked=flag;
System.Boolean.TryParse(project.Variables["st23"].Value, out flag);
chbox23.Checked=flag;
System.Boolean.TryParse(project.Variables["st24"].Value, out flag);
chbox24.Checked=flag;
System.Boolean.TryParse(project.Variables["st25"].Value, out flag);
chbox25.Checked=flag;
System.Boolean.TryParse(project.Variables["st25"].Value, out flag);
chbox26.Checked=flag;
//запускаем форму
Z.ShowDialog();
//забираем значения установленные в чекбоксы
project.Variables["st1"].Value = chbox1.Checked.ToString();
project.Variables["st2"].Value = chbox2.Checked.ToString();
project.Variables["st3"].Value = chbox3.Checked.ToString();
project.Variables["st4"].Value = chbox4.Checked.ToString();
project.Variables["st5"].Value = chbox5.Checked.ToString();
project.Variables["st6"].Value = chbox6.Checked.ToString();
project.Variables["st7"].Value = chbox7.Checked.ToString();
project.Variables["st8"].Value = chbox8.Checked.ToString();
project.Variables["st9"].Value = chbox9.Checked.ToString();
project.Variables["st10"].Value = chbox10.Checked.ToString();
project.Variables["st11"].Value = chbox11.Checked.ToString();
project.Variables["st12"].Value = chbox12.Checked.ToString();
project.Variables["st13"].Value = chbox13.Checked.ToString();
project.Variables["st14"].Value = chbox14.Checked.ToString();
project.Variables["st15"].Value = chbox15.Checked.ToString();
project.Variables["st16"].Value = chbox16.Checked.ToString();
project.Variables["st17"].Value = chbox17.Checked.ToString();
project.Variables["st18"].Value = chbox18.Checked.ToString();
project.Variables["st19"].Value = chbox19.Checked.ToString();
project.Variables["st20"].Value = chbox20.Checked.ToString();
project.Variables["st21"].Value = chbox21.Checked.ToString();
project.Variables["st22"].Value = chbox22.Checked.ToString();
project.Variables["st23"].Value = chbox23.Checked.ToString();
project.Variables["st24"].Value = chbox24.Checked.ToString();
project.Variables["st25"].Value = chbox25.Checked.ToString();
project.Variables["st26"].Value = chbox26.Checked.ToString();
return 0;