
- •If (!PromptToSave())
- •If (!PromptToSave())
- •If (!PromptToSave())
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
- •InitializeComponent();
InitializeComponent();
}
private void butPostoyan_Click(object sender, EventArgs e)
{
Colonna.TypeColonna = "Постоянная";
Postoyan f = new Postoyan();
f.Show();
this.Hide();
}
private void butDvestu_Click(object sender, EventArgs e)
{
Colonna.TypeColonna = "Двухступенчатая";
DveStupeni f = new DveStupeni();
f.Show();
this.Hide();
}
private void butDvestup_Click(object sender, EventArgs e)
{
Colonna.TypeColonna = "Двухступенчатая1";
DveStupeni f = new DveStupeni();
f.Show();
this.Hide();
}
private void butTristu_Click(object sender, EventArgs e)
{
Colonna.TypeColonna = "Трёхступенчатая";
TriStupeni f = new TriStupeni();
f.Show();
this.Hide();}}}
П1.3. Листинг формы «Одноступенчатая колонна»
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DrawToolsLib;
namespace DrawTools
{
public partial class Postoyan : Form
{
double[] heightPloshadka = null;
double[] heightZaborchik = null;
int kolPlatforms = 0;
double Dn = 0;
double Hv = 0;
public double Hn
{
get
{
try
{
Hv = Convert.ToDouble(txtVisota.Text);
}
catch (FormatException)
{
MessageBox.Show("Неправильное значение высоты");
}
if (Dn < 0.8)
if (Hv > 20 || Hv < 1)
{
MessageBox.Show("Введите значение высоты до 20 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
if (Dn == 1)
if (Hv > 23 || Hv < 1)
{
MessageBox.Show("Введите значение высоты до 23 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
if (Dn > 1.2 && Dn < 2.2)
if (Hv > 30 || Hv < 1)
{
MessageBox.Show("Введите значение высоты до 30 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
if (Dn > 2.4)
if (Hv > 50 || Hv < 1)
{
MessageBox.Show("Введите значение высоты до 50 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
return Hv;
}
}
public Postoyan()
{
InitializeComponent();
InitComboD();
InitComboS();
txtFund.Text = "6";
txtIsol.Text = "0.3";
txtKolichestv.Text = "5";
txtNapr.Text = "1700";
txtPlotn.Text = "10";
txtVodupr.Text = "2000000";
txtVisota.Text = "4";
butPloshadki.Visible = false;
txtKolichestv.ReadOnly = true;
comboGrunt.Text = comboGrunt.Items[0].ToString();
comboRaion.Text = comboRaion.Items[0].ToString();
comboD.Text = comboD.Items[0].ToString();
comboS.Text = comboS.Items[17].ToString();
}
public void shpionDiam(object diam, object t)
{
if(diam.ToString()!="")
Colonna.diametr.Add(diam);
if(t.ToString()!="")
Colonna.vis.Add(t);
InitComboD();
InitComboS();
}
private void InitComboD()
{
foreach (object i in Colonna.diametr)
comboD.Items.Add(i);
}
private void InitComboS()
{
foreach (object i in Colonna.vis)
comboS.Items.Add(i);
}
private void butDalee_Click(object sender, EventArgs e)
{
peremen.nalicPloscha = checkPloshadki.Checked;
string grun = " ";
double Tn = 0;
double Dfun = 0;
double Is = 0;
double Mupr = 0;
double Plot = 0;
double Napr = 0;
string raion = " ";
int gr = 0;
try
{
Dn = Convert.ToDouble(comboD.Text);
}
catch (FormatException)
{
comboD.Text = "введите значение";
}
try
{
Tn = Convert.ToDouble(comboS.Text);
}
catch (FormatException)
{
comboS.Text = "Введите значение";
}
try
{
Is = Convert.ToDouble(txtIsol.Text);
}
catch (FormatException)
{
txtIsol.Text = "Ошибка ввода";
}
try
{
Dfun = Convert.ToDouble(txtFund.Text);
}
catch (FormatException)
{
txtFund.Text = "Ошибка ввода";
}
try
{
Mupr = Convert.ToDouble(txtVodupr.Text);
}
catch (FormatException)
{
txtVodupr.Text = "Ошибка ввода";
}
try
{
Plot = Convert.ToDouble(txtPlotn.Text);
}
catch (FormatException)
{
txtPlotn.Text = "Ошибка ввода";
}
try
{
Napr = Convert.ToDouble(txtNapr.Text);
}
catch (FormatException)
{
txtNapr.Text = "Ошибка ввода";
}
try
{
raion = comboRaion.Text;
}
catch (FormatException)
{
comboRaion.Text = "Выберите значение";
}
try
{
grun = comboGrunt.Text;
}
catch (FormatException)
{
comboGrunt.Text = "Выберите значение";
}
bool Pl = false;
if (checkPloshadki.Checked) Pl = true;
if (checkGruppa.Checked)
{
try
{
gr = Convert.ToInt32(txtKolichestv.Text);
}
catch (FormatException)
{
txtKolichestv.Text = "Ошибка ввода";
}
}
bool Kol = false;
if (checkGruppa.Checked) Kol = true;
bool Isol = false;
if (checkIsolya.Checked) Isol = true;
Hv = this.Hn;
if (this.Hv != 0)
{
Colonna d = new Colonna(grun, Dn, Hn, Tn, Isol, Is, Mupr, Plot, Napr, raion, Dfun, Pl, kolPlatforms, Kol, heightZaborchik, heightPloshadka, gr);
Sechenie f = new Sechenie(d);
f.Show();
this.Close();
}
}
private void butNazad_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
f.Show();
this.Close();
}
private void butCarta_Click(object sender, EventArgs e)
{
Carta g = new Carta();
g.Show();
}
private void butPloshadki_Click(object sender, EventArgs e)
{
Ploshadki f = new Ploshadki(new MyDelegate(func));
f.ShowDialog();
}
void func(double[] platform, double[] fence, int kolPlat)
{
heightPloshadka = platform;
heightZaborchik = fence;
kolPlatforms = kolPlat;
}
private void checkPloshadki_CheckedChanged(object sender, EventArgs e)
{
if (checkPloshadki.Checked) butPloshadki.Visible = true;
else butPloshadki.Visible = false;
}
private void checkGruppa_CheckedChanged(object sender, EventArgs e)
{
if (checkGruppa.Checked) txtKolichestv.ReadOnly = false;
else txtKolichestv.ReadOnly = true;
}
private void txtVisota_TextChanged(object sender, EventArgs e)
{
Colonna.ExportD = comboD.Text;
Colonna.ExportS = comboS.Text;
Colonna.ExportH = txtVisota.Text;
}
private void button1_Click(object sender, EventArgs e)
{
Gost f = new Gost(new DelegatD(shpionDiam));
f.Show();
}
}}
П1.4. Листинг формы «Двухступенчатая колонна»
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using DrawToolsLib;
namespace DrawTools
{
public partial class DveStupeni : Form
{
double[] heightPloshadka = null;
double[] heightZaborchik = null;
int kolPlatforms = 0;
double Dn = 0;
double Dn1 = 0;
double Hv = 0;
double Hv1 = 0;
public double Hn
{
get
{
try
{
Hv = Convert.ToDouble(txtVisota.Text);
}
catch (FormatException)
{
MessageBox.Show("Неправильное значение высоты");
}
if (Dn < 0.8)
if (Hv > 20 || Hv < 1)
{
MessageBox.Show("Введите значение высоты до 20 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
if (Dn == 1)
if (Hv > 23 || Hv < 1)
{
MessageBox.Show("Введите значение высоты до 23 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
if (Dn > 1.2 && Dn < 1.8)
if (Hv > 25 || Hv < 1)
{
MessageBox.Show("Введите значение высоты до 30 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
return Hv;
}
}
public double Hn1
{
get
{
try
{
Hv1 = Convert.ToDouble(txtVisota1.Text);
}
catch (FormatException)
{
MessageBox.Show("Неправильное значение высоты");
}
if (Dn1 < 0.8)
if (Hv1 > 20 || Hv1 < 1)
{
MessageBox.Show("Введите значение высоты до 20 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
if (Dn1 == 1)
if (Hv1 > 23 || Hv1 < 1)
{
MessageBox.Show("Введите значение высоты до 23 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
if (Dn1 > 1.2 && Dn1 < 1.8)
if (Hv1 > 25 || Hv1 < 1)
{
MessageBox.Show("Введите значение высоты до 30 метров");
txtVisota.Text = "";
txtVisota.Focus();
return 0;
}
return Hv1;
}
}
public DveStupeni()
{