PIbd-23 Firsov Kirill LabWork 05 #21
@ -41,12 +41,12 @@
|
||||
this.panel6 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxBlade = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxWheelsOrnament = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
|
||||
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
||||
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||
this.panel16 = new System.Windows.Forms.Panel();
|
||||
this.panel17 = new System.Windows.Forms.Panel();
|
||||
this.panel24 = new System.Windows.Forms.Panel();
|
||||
@ -60,7 +60,7 @@
|
||||
this.panel8 = new System.Windows.Forms.Panel();
|
||||
this.panel9 = new System.Windows.Forms.Panel();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
@ -71,10 +71,10 @@
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.panel18.SuspendLayout();
|
||||
this.panel19.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||
this.groupBox3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
@ -82,12 +82,12 @@
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Controls.Add(this.groupBox2);
|
||||
this.groupBox1.Controls.Add(this.checkBox2);
|
||||
this.groupBox1.Controls.Add(this.checkBox1);
|
||||
this.groupBox1.Controls.Add(this.checkBoxBlade);
|
||||
this.groupBox1.Controls.Add(this.checkBoxWheelsOrnament);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Controls.Add(this.numericUpDown2);
|
||||
this.groupBox1.Controls.Add(this.numericUpDown1);
|
||||
this.groupBox1.Controls.Add(this.numericUpDownWeight);
|
||||
this.groupBox1.Controls.Add(this.numericUpDownSpeed);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 0);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(585, 341);
|
||||
@ -200,25 +200,25 @@
|
||||
this.panel1.Size = new System.Drawing.Size(40, 40);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// checkBox2
|
||||
// checkBoxBlade
|
||||
//
|
||||
this.checkBox2.AutoSize = true;
|
||||
this.checkBox2.Location = new System.Drawing.Point(32, 227);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(205, 24);
|
||||
this.checkBox2.TabIndex = 5;
|
||||
this.checkBox2.Text = "Признак наличия отвала";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
this.checkBoxBlade.AutoSize = true;
|
||||
this.checkBoxBlade.Location = new System.Drawing.Point(32, 227);
|
||||
this.checkBoxBlade.Name = "checkBoxBlade";
|
||||
this.checkBoxBlade.Size = new System.Drawing.Size(205, 24);
|
||||
this.checkBoxBlade.TabIndex = 5;
|
||||
this.checkBoxBlade.Text = "Признак наличия отвала";
|
||||
this.checkBoxBlade.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBox1
|
||||
// checkBoxWheelsOrnament
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(32, 286);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(305, 24);
|
||||
this.checkBox1.TabIndex = 4;
|
||||
this.checkBox1.Text = "Признак наличия орнамета на колесах";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBoxWheelsOrnament.AutoSize = true;
|
||||
this.checkBoxWheelsOrnament.Location = new System.Drawing.Point(32, 286);
|
||||
this.checkBoxWheelsOrnament.Name = "checkBoxWheelsOrnament";
|
||||
this.checkBoxWheelsOrnament.Size = new System.Drawing.Size(305, 24);
|
||||
this.checkBoxWheelsOrnament.TabIndex = 4;
|
||||
this.checkBoxWheelsOrnament.Text = "Признак наличия орнамета на колесах";
|
||||
this.checkBoxWheelsOrnament.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
@ -238,19 +238,49 @@
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Скорость";
|
||||
//
|
||||
// numericUpDown2
|
||||
// numericUpDownWeight
|
||||
//
|
||||
this.numericUpDown2.Location = new System.Drawing.Point(132, 80);
|
||||
this.numericUpDown2.Name = "numericUpDown2";
|
||||
this.numericUpDown2.Size = new System.Drawing.Size(109, 27);
|
||||
this.numericUpDown2.TabIndex = 1;
|
||||
this.numericUpDownWeight.Location = new System.Drawing.Point(132, 80);
|
||||
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownWeight.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
this.numericUpDownWeight.Size = new System.Drawing.Size(109, 27);
|
||||
this.numericUpDownWeight.TabIndex = 1;
|
||||
this.numericUpDownWeight.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// numericUpDown1
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
this.numericUpDown1.Location = new System.Drawing.Point(132, 26);
|
||||
this.numericUpDown1.Name = "numericUpDown1";
|
||||
this.numericUpDown1.Size = new System.Drawing.Size(109, 27);
|
||||
this.numericUpDown1.TabIndex = 0;
|
||||
this.numericUpDownSpeed.Location = new System.Drawing.Point(132, 26);
|
||||
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
this.numericUpDownSpeed.Size = new System.Drawing.Size(109, 27);
|
||||
this.numericUpDownSpeed.TabIndex = 0;
|
||||
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// panel16
|
||||
//
|
||||
@ -340,7 +370,7 @@
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.label6);
|
||||
this.groupBox3.Controls.Add(this.label5);
|
||||
this.groupBox3.Controls.Add(this.pictureBox1);
|
||||
this.groupBox3.Controls.Add(this.pictureBoxObject);
|
||||
this.groupBox3.Location = new System.Drawing.Point(603, 12);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(267, 287);
|
||||
@ -348,13 +378,13 @@
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "groupBox3";
|
||||
//
|
||||
// pictureBox1
|
||||
// pictureBoxObject
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(6, 63);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(255, 218);
|
||||
this.pictureBox1.TabIndex = 2;
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBoxObject.Location = new System.Drawing.Point(6, 63);
|
||||
this.pictureBoxObject.Name = "pictureBoxObject";
|
||||
this.pictureBoxObject.Size = new System.Drawing.Size(255, 218);
|
||||
this.pictureBoxObject.TabIndex = 2;
|
||||
this.pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// button5
|
||||
//
|
||||
@ -376,49 +406,46 @@
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.label3.Location = new System.Drawing.Point(369, 171);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
|
||||
this.label3.Size = new System.Drawing.Size(71, 42);
|
||||
this.label3.Size = new System.Drawing.Size(74, 42);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "Простой";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.label4.Location = new System.Drawing.Point(458, 171);
|
||||
this.label4.Enabled = false;
|
||||
this.label4.Location = new System.Drawing.Point(449, 171);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
|
||||
this.label4.Size = new System.Drawing.Size(107, 42);
|
||||
this.label4.Size = new System.Drawing.Size(114, 42);
|
||||
this.label4.TabIndex = 8;
|
||||
this.label4.Text = "Продвинутый";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.label5.Location = new System.Drawing.Point(28, 23);
|
||||
this.label5.Location = new System.Drawing.Point(6, 23);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Padding = new System.Windows.Forms.Padding(25, 5, 25, 5);
|
||||
this.label5.Size = new System.Drawing.Size(94, 32);
|
||||
this.label5.Padding = new System.Windows.Forms.Padding(35, 5, 25, 5);
|
||||
this.label5.Size = new System.Drawing.Size(119, 32);
|
||||
this.label5.TabIndex = 3;
|
||||
this.label5.Text = "Цвет";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.label6.Location = new System.Drawing.Point(141, 23);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5);
|
||||
this.label6.Size = new System.Drawing.Size(97, 32);
|
||||
this.label6.Size = new System.Drawing.Size(120, 32);
|
||||
this.label6.TabIndex = 4;
|
||||
this.label6.Text = "Доп. цвет";
|
||||
//
|
||||
@ -438,11 +465,10 @@
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.panel18.ResumeLayout(false);
|
||||
this.panel19.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -455,12 +481,12 @@
|
||||
private Panel panel2;
|
||||
private Panel panel5;
|
||||
private Panel panel4;
|
||||
private CheckBox checkBox2;
|
||||
private CheckBox checkBox1;
|
||||
private CheckBox checkBoxBlade;
|
||||
private CheckBox checkBoxWheelsOrnament;
|
||||
private Label label2;
|
||||
private Label label1;
|
||||
private NumericUpDown numericUpDown2;
|
||||
private NumericUpDown numericUpDown1;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Panel panel18;
|
||||
private Panel panel19;
|
||||
private Panel panel20;
|
||||
@ -485,7 +511,7 @@
|
||||
private GroupBox groupBox3;
|
||||
private Label label6;
|
||||
private Label label5;
|
||||
private PictureBox pictureBox1;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Button button5;
|
||||
private Button button6;
|
||||
}
|
||||
|
@ -7,14 +7,86 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ProjectTractor.DrawningObjects;
|
||||
|
||||
namespace ProjectTractor
|
||||
namespace ProjectTractor;
|
||||
|
||||
public partial class FormTractorConfig : Form
|
||||
{
|
||||
public partial class FormTractorConfig : Form
|
||||
/// <summary>
|
||||
/// Переменная-выбранная машина
|
||||
/// </summary>
|
||||
DrawningTractor? _tractor = null;
|
||||
/// <summary>
|
||||
/// Событие
|
||||
/// </summary>
|
||||
private event TractorDelegate? EventAddTractor;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public FormTractorConfig()
|
||||
{
|
||||
public FormTractorConfig()
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// Отрисовать машину
|
||||
/// </summary>
|
||||
private void DrawTractor()
|
||||
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_tractor?.SetPosition(5, 5);
|
||||
_tractor?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
/// <summary>
|
||||
/// Передаем информацию при нажатии на Label
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name,
|
||||
DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
/// <summary>
|
||||
/// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
{
|
||||
InitializeComponent();
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Действия при приеме перетаскиваемой информации
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelSimpleObject":
|
||||
_tractor = new DrawningTractor((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
|
||||
pictureBoxObject.Height);
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_tractor = new DrawningBulldoser((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxBlade.Checked,
|
||||
checkBoxWheelsOrnament.Checked, pictureBoxObject.Width,
|
||||
pictureBoxObject.Height);
|
||||
break;
|
||||
}
|
||||
DrawTractor();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
Делегат следовало заменить на встроенный