Загрузка данных
namespace lr16
{
partial class Form1
{
private System.ComponentModel.IContainer components = null;
// Элементы управления
private Label lblTitle;
private GroupBox gbMethod;
private Label lblMethodInfo;
private RadioButton rbMethod1;
private RadioButton rbMethod2;
private GroupBox gbCoefficients;
private Label lblA, lblB, lblC;
private ComboBox cbA, cbB, cbC;
private GroupBox gbVariables;
private Label lblX, lblY, lblZ;
private TextBox tbX, tbY, tbZ;
private CheckBox cbIncludeZ;
private Button btnCalculate;
private Button btnClear;
private GroupBox gbResult;
private Label lblResult;
private ListBox lbHistory;
private ToolTip toolTip1;
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.toolTip1 = new ToolTip(this.components);
this.ClientSize = new Size(760, 650);
this.Text = "Лабораторная работа №16 — Вариант 10";
this.StartPosition = FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.BackColor = Color.WhiteSmoke;
// Заголовок
this.lblTitle = new Label
{
Text = "Лабораторная работа №16\nМеханизм событий. Простые элементы управления\nВариант 10",
Font = new Font("Segoe UI", 15F, FontStyle.Bold),
TextAlign = ContentAlignment.MiddleCenter,
Location = new Point(20, 10),
Size = new Size(720, 80),
ForeColor = Color.DarkBlue
};
// Группа способа расчёта
this.gbMethod = new GroupBox
{
Text = "Способ расчёта",
Location = new Point(30, 100),
Size = new Size(700, 110),
Font = new Font("Segoe UI", 10F, FontStyle.Bold)
};
this.lblMethodInfo = new Label
{
Text = "Выбран способ: Прямое вычисление",
Location = new Point(20, 25),
Size = new Size(500, 20)
};
this.rbMethod1 = new RadioButton
{
Text = "Способ 1: Прямое вычисление W = a·x + b·y + c·z",
Location = new Point(20, 50),
AutoSize = true
};
this.rbMethod1.CheckedChanged += rbMethod1_CheckedChanged;
this.rbMethod2 = new RadioButton
{
Text = "Способ 2: Через массив коэффициентов и цикл for",
Location = new Point(20, 75),
AutoSize = true
};
this.rbMethod2.CheckedChanged += rbMethod2_CheckedChanged;
gbMethod.Controls.Add(lblMethodInfo);
gbMethod.Controls.Add(rbMethod1);
gbMethod.Controls.Add(rbMethod2);
// Группа коэффициентов
this.gbCoefficients = new GroupBox
{
Text = "Коэффициенты a, b, c",
Location = new Point(30, 220),
Size = new Size(350, 145),
Font = new Font("Segoe UI", 10F, FontStyle.Bold)
};
this.lblA = new Label { Text = "a =", Location = new Point(25, 35), AutoSize = true };
this.cbA = new ComboBox { Location = new Point(80, 32), Width = 120, DropDownStyle = ComboBoxStyle.DropDownList };
this.lblB = new Label { Text = "b =", Location = new Point(25, 70), AutoSize = true };
this.cbB = new ComboBox { Location = new Point(80, 67), Width = 120, DropDownStyle = ComboBoxStyle.DropDownList };
this.lblC = new Label { Text = "c =", Location = new Point(25, 105), AutoSize = true };
this.cbC = new ComboBox { Location = new Point(80, 102), Width = 120, DropDownStyle = ComboBoxStyle.DropDownList };
gbCoefficients.Controls.Add(lblA); gbCoefficients.Controls.Add(cbA);
gbCoefficients.Controls.Add(lblB); gbCoefficients.Controls.Add(cbB);
gbCoefficients.Controls.Add(lblC); gbCoefficients.Controls.Add(cbC);
// Группа переменных
this.gbVariables = new GroupBox
{
Text = "Переменные x, y, z",
Location = new Point(400, 220),
Size = new Size(330, 145),
Font = new Font("Segoe UI", 10F, FontStyle.Bold)
};
this.lblX = new Label { Text = "x =", Location = new Point(25, 35), AutoSize = true };
this.tbX = new TextBox { Location = new Point(80, 32), Width = 120, TextAlign = HorizontalAlignment.Center };
this.lblY = new Label { Text = "y =", Location = new Point(25, 70), AutoSize = true };
this.tbY = new TextBox { Location = new Point(80, 67), Width = 120, TextAlign = HorizontalAlignment.Center };
this.lblZ = new Label { Text = "z =", Location = new Point(25, 105), AutoSize = true };
this.tbZ = new TextBox { Location = new Point(80, 102), Width = 120, TextAlign = HorizontalAlignment.Center };
this.cbIncludeZ = new CheckBox
{
Text = "Включить z в расчёт",
Location = new Point(25, 135),
Checked = true
};
this.cbIncludeZ.CheckedChanged += cbIncludeZ_CheckedChanged;
gbVariables.Controls.Add(lblX); gbVariables.Controls.Add(tbX);
gbVariables.Controls.Add(lblY); gbVariables.Controls.Add(tbY);
gbVariables.Controls.Add(lblZ); gbVariables.Controls.Add(tbZ);
gbVariables.Controls.Add(cbIncludeZ);
// Кнопки
this.btnCalculate = new Button
{
Text = "Вычислить W",
Location = new Point(30, 380),
Size = new Size(180, 50),
Font = new Font("Segoe UI", 11F, FontStyle.Bold),
BackColor = Color.FromArgb(0, 122, 204),
ForeColor = Color.White
};
this.btnCalculate.Click += btnCalculate_Click;
this.btnClear = new Button
{
Text = "Очистить историю",
Location = new Point(230, 380),
Size = new Size(160, 50)
};
this.btnClear.Click += btnClear_Click;
// Результат
this.gbResult = new GroupBox
{
Text = "Результат расчёта",
Location = new Point(30, 445),
Size = new Size(700, 80),
Font = new Font("Segoe UI", 10F, FontStyle.Bold)
};
this.lblResult = new Label
{
Text = "Результат: W = ?",
Location = new Point(20, 28),
Size = new Size(660, 40),
Font = new Font("Segoe UI", 14F, FontStyle.Bold),
ForeColor = Color.DarkGreen
};
gbResult.Controls.Add(lblResult);
// История
this.lbHistory = new ListBox
{
Location = new Point(30, 540),
Size = new Size(700, 90),
Font = new Font("Consolas", 9.5F)
};
// Добавляем всё на форму
this.Controls.Add(lblTitle);
this.Controls.Add(gbMethod);
this.Controls.Add(gbCoefficients);
this.Controls.Add(gbVariables);
this.Controls.Add(btnCalculate);
this.Controls.Add(btnClear);
this.Controls.Add(gbResult);
this.Controls.Add(lbHistory);
}
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
components.Dispose();
base.Dispose(disposing);
}
}
}