зафиксировать всёё
This commit is contained in:
parent
568f6fe9ed
commit
f0bfd7e353
15
ProjectBoat_base/ProjectBoat_bae/BoatDelegate.cs
Normal file
15
ProjectBoat_base/ProjectBoat_bae/BoatDelegate.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
internal class BoatDelegate
|
||||
{
|
||||
// Делегат для передачи объекта-автомобиля
|
||||
public delegate void boatDelegate(Drawningboat boat);
|
||||
}
|
||||
}
|
@ -30,8 +30,9 @@
|
||||
{
|
||||
pictureBoxObject = new PictureBox();
|
||||
groupBoxBoat = new GroupBox();
|
||||
checkBox1 = new CheckBox();
|
||||
labelModifiedObject = new Label();
|
||||
LabelEasy = new Label();
|
||||
labelSimpleObject = new Label();
|
||||
groupBoxColors = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelGray = new Panel();
|
||||
@ -41,26 +42,24 @@
|
||||
panelBlue = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
checkBox3 = new CheckBox();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
Speed = new Label();
|
||||
checkBoxBoat = new CheckBox();
|
||||
checkBoxRainforce = new CheckBox();
|
||||
Weight = new Label();
|
||||
Panelcolor = new Panel();
|
||||
AddColorbutton = new Label();
|
||||
Colorlabel = new Label();
|
||||
pictureBox1 = new PictureBox();
|
||||
PanelObject = new Panel();
|
||||
LabelAdditionalColor = new Label();
|
||||
LabelColor = new Label();
|
||||
buttonOk = new Button();
|
||||
buttonCancel = new Button();
|
||||
pictureBox1 = new PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
groupBoxBoat.SuspendLayout();
|
||||
groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
Panelcolor.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
PanelObject.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxObject
|
||||
@ -73,15 +72,14 @@
|
||||
//
|
||||
// groupBoxBoat
|
||||
//
|
||||
groupBoxBoat.Controls.Add(checkBox1);
|
||||
groupBoxBoat.Controls.Add(labelModifiedObject);
|
||||
groupBoxBoat.Controls.Add(LabelEasy);
|
||||
groupBoxBoat.Controls.Add(labelSimpleObject);
|
||||
groupBoxBoat.Controls.Add(groupBoxColors);
|
||||
groupBoxBoat.Controls.Add(checkBox3);
|
||||
groupBoxBoat.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxBoat.Controls.Add(numericUpDownWeight);
|
||||
groupBoxBoat.Controls.Add(Speed);
|
||||
groupBoxBoat.Controls.Add(checkBoxBoat);
|
||||
groupBoxBoat.Controls.Add(checkBoxRainforce);
|
||||
groupBoxBoat.Controls.Add(Weight);
|
||||
groupBoxBoat.Controls.Add(pictureBox1);
|
||||
groupBoxBoat.Location = new Point(12, 12);
|
||||
@ -91,6 +89,16 @@
|
||||
groupBoxBoat.TabStop = false;
|
||||
groupBoxBoat.Text = "Параметры";
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
checkBox1.AutoSize = true;
|
||||
checkBox1.Location = new Point(21, 236);
|
||||
checkBox1.Name = "checkBox1";
|
||||
checkBox1.Size = new Size(230, 29);
|
||||
checkBox1.TabIndex = 12;
|
||||
checkBox1.Text = "Признак наличия весел";
|
||||
checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelModifiedObject
|
||||
//
|
||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
@ -101,17 +109,17 @@
|
||||
labelModifiedObject.Text = "Продвинутый";
|
||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// LabelEasy
|
||||
// labelSimpleObject
|
||||
//
|
||||
LabelEasy.BorderStyle = BorderStyle.FixedSingle;
|
||||
LabelEasy.Location = new Point(334, 227);
|
||||
LabelEasy.Name = "LabelEasy";
|
||||
LabelEasy.Size = new Size(124, 38);
|
||||
LabelEasy.TabIndex = 10;
|
||||
LabelEasy.Text = "Простой";
|
||||
LabelEasy.TextAlign = ContentAlignment.MiddleCenter;
|
||||
LabelEasy.Click += LabelEasy_Click;
|
||||
LabelEasy.MouseDown += LabelObject_MouseDown;
|
||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimpleObject.Location = new Point(334, 227);
|
||||
labelSimpleObject.Name = "labelSimpleObject";
|
||||
labelSimpleObject.Size = new Size(124, 38);
|
||||
labelSimpleObject.TabIndex = 10;
|
||||
labelSimpleObject.Text = "Простой";
|
||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimpleObject.Click += labelSimpleObject_Click;
|
||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
@ -194,16 +202,6 @@
|
||||
panelRed.Size = new Size(45, 45);
|
||||
panelRed.TabIndex = 10;
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
checkBox3.AutoSize = true;
|
||||
checkBox3.Location = new Point(21, 299);
|
||||
checkBox3.Name = "checkBox3";
|
||||
checkBox3.Size = new Size(108, 29);
|
||||
checkBox3.TabIndex = 8;
|
||||
checkBox3.Text = "Признак";
|
||||
checkBox3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(148, 61);
|
||||
@ -238,20 +236,11 @@
|
||||
checkBoxBoat.AutoSize = true;
|
||||
checkBoxBoat.Location = new Point(21, 176);
|
||||
checkBoxBoat.Name = "checkBoxBoat";
|
||||
checkBoxBoat.Size = new Size(180, 29);
|
||||
checkBoxBoat.Size = new Size(230, 29);
|
||||
checkBoxBoat.TabIndex = 6;
|
||||
checkBoxBoat.Text = "Признак наличия";
|
||||
checkBoxBoat.Text = "Признак наличия весел";
|
||||
checkBoxBoat.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxRainforce
|
||||
//
|
||||
checkBoxRainforce.AutoSize = true;
|
||||
checkBoxRainforce.Location = new Point(21, 236);
|
||||
checkBoxRainforce.Name = "checkBoxRainforce";
|
||||
checkBoxRainforce.Size = new Size(108, 29);
|
||||
checkBoxRainforce.TabIndex = 7;
|
||||
checkBoxRainforce.Text = "Признак";
|
||||
checkBoxRainforce.UseVisualStyleBackColor = true;
|
||||
checkBoxBoat.CheckedChanged += checkBoxBoat_CheckedChanged;
|
||||
//
|
||||
// Weight
|
||||
//
|
||||
@ -262,38 +251,48 @@
|
||||
Weight.TabIndex = 3;
|
||||
Weight.Text = "Вес";
|
||||
//
|
||||
// Panelcolor
|
||||
// pictureBox1
|
||||
//
|
||||
Panelcolor.AllowDrop = true;
|
||||
Panelcolor.BorderStyle = BorderStyle.FixedSingle;
|
||||
Panelcolor.Controls.Add(AddColorbutton);
|
||||
Panelcolor.Controls.Add(Colorlabel);
|
||||
Panelcolor.Controls.Add(pictureBoxObject);
|
||||
Panelcolor.Location = new Point(696, 23);
|
||||
Panelcolor.Name = "Panelcolor";
|
||||
Panelcolor.Size = new Size(460, 378);
|
||||
Panelcolor.TabIndex = 2;
|
||||
Panelcolor.MouseDown += PanelColor_MouseDown;
|
||||
pictureBox1.Location = new Point(0, 0);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(668, 449);
|
||||
pictureBox1.TabIndex = 2;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// AddColorbutton
|
||||
// PanelObject
|
||||
//
|
||||
AddColorbutton.AutoSize = true;
|
||||
AddColorbutton.BorderStyle = BorderStyle.FixedSingle;
|
||||
AddColorbutton.Location = new Point(333, 38);
|
||||
AddColorbutton.Name = "AddColorbutton";
|
||||
AddColorbutton.Size = new Size(93, 27);
|
||||
AddColorbutton.TabIndex = 1;
|
||||
AddColorbutton.Text = "Доп. цвет";
|
||||
PanelObject.AllowDrop = true;
|
||||
PanelObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
PanelObject.Controls.Add(LabelAdditionalColor);
|
||||
PanelObject.Controls.Add(LabelColor);
|
||||
PanelObject.Controls.Add(pictureBoxObject);
|
||||
PanelObject.Location = new Point(696, 23);
|
||||
PanelObject.Name = "PanelObject";
|
||||
PanelObject.Size = new Size(460, 378);
|
||||
PanelObject.TabIndex = 2;
|
||||
PanelObject.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// Colorlabel
|
||||
// LabelAdditionalColor
|
||||
//
|
||||
Colorlabel.AutoSize = true;
|
||||
Colorlabel.BorderStyle = BorderStyle.FixedSingle;
|
||||
Colorlabel.Location = new Point(38, 38);
|
||||
Colorlabel.Name = "Colorlabel";
|
||||
Colorlabel.Size = new Size(53, 27);
|
||||
Colorlabel.TabIndex = 0;
|
||||
Colorlabel.Text = "Цвет";
|
||||
LabelAdditionalColor.AllowDrop = true;
|
||||
LabelAdditionalColor.AutoSize = true;
|
||||
LabelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
LabelAdditionalColor.Location = new Point(333, 38);
|
||||
LabelAdditionalColor.Name = "LabelAdditionalColor";
|
||||
LabelAdditionalColor.Size = new Size(93, 27);
|
||||
LabelAdditionalColor.TabIndex = 1;
|
||||
LabelAdditionalColor.Text = "Доп. цвет";
|
||||
//
|
||||
// LabelColor
|
||||
//
|
||||
LabelColor.AllowDrop = true;
|
||||
LabelColor.AutoSize = true;
|
||||
LabelColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
LabelColor.Location = new Point(38, 38);
|
||||
LabelColor.Name = "LabelColor";
|
||||
LabelColor.Size = new Size(53, 27);
|
||||
LabelColor.TabIndex = 0;
|
||||
LabelColor.Text = "Цвет";
|
||||
//
|
||||
// buttonOk
|
||||
//
|
||||
@ -313,14 +312,6 @@
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.Location = new Point(0, 0);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(668, 449);
|
||||
pictureBox1.TabIndex = 2;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// FormBoatConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
@ -328,7 +319,7 @@
|
||||
ClientSize = new Size(1178, 498);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonOk);
|
||||
Controls.Add(Panelcolor);
|
||||
Controls.Add(PanelObject);
|
||||
Controls.Add(groupBoxBoat);
|
||||
Name = "FormBoatConfig";
|
||||
Text = "FormBoatConfig";
|
||||
@ -338,9 +329,9 @@
|
||||
groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
Panelcolor.ResumeLayout(false);
|
||||
Panelcolor.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
PanelObject.ResumeLayout(false);
|
||||
PanelObject.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -353,10 +344,8 @@
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private GroupBox groupBoxColors;
|
||||
private CheckBox checkBox3;
|
||||
private CheckBox checkBoxBoat;
|
||||
private CheckBox checkBoxRainforce;
|
||||
private Label LabelEasy;
|
||||
private Label labelSimpleObject;
|
||||
private Panel panelPurple;
|
||||
private Panel panelGray;
|
||||
private Panel panelWhite;
|
||||
@ -366,11 +355,12 @@
|
||||
private Panel panelGreen;
|
||||
private Panel panelRed;
|
||||
private Label labelModifiedObject;
|
||||
private Panel Panelcolor;
|
||||
private Panel PanelObject;
|
||||
private Button buttonOk;
|
||||
private Button buttonCancel;
|
||||
private Label AddColorbutton;
|
||||
private Label Colorlabel;
|
||||
private Label LabelAdditionalColor;
|
||||
private Label LabelColor;
|
||||
private PictureBox pictureBox1;
|
||||
private CheckBox checkBox1;
|
||||
}
|
||||
}
|
@ -46,11 +46,13 @@ namespace ProjectBoat_bae
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
||||
buttonCancel.Click += (s, e) => Close();
|
||||
}
|
||||
|
||||
// Метод прорисовки
|
||||
private void Draw()
|
||||
private void DrawBoat()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
@ -81,17 +83,33 @@ namespace ProjectBoat_bae
|
||||
// Действия при приеме перетаскиваемой информации
|
||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
//switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
//{
|
||||
// case "labelSimpleObject":
|
||||
// _boat = new Drawningboat((int)numericUpDownSpeed.Value,
|
||||
// (int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
// break;
|
||||
// case "labelModifiedObject":
|
||||
// _boat = new DrawningMotorBoat((int)numericUpDownSpeed.Value,
|
||||
// (int)numericUpDownWeight.Value, Color.White, Color.Black,
|
||||
// checkBoxBoat.Checked, checkBoxBoat.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
// break;
|
||||
//}
|
||||
//LabelColor.BackColor = Color.Empty;
|
||||
//LabelAdditionalColor.BackColor = Color.Empty;
|
||||
//DrawBoat();
|
||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelEasy":
|
||||
case "labelSimpleObject":
|
||||
_boat = new Drawningboat((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_boat = new DrawningMotorBoat((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black,
|
||||
checkBoxBoat.Checked, checkBoxRainforce.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
_boat = new DrawningMotorBoat((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxBoat.Checked, checkBox1.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
LabelColor.BackColor = Color.Empty;
|
||||
LabelAdditionalColor.BackColor = Color.Empty;
|
||||
DrawBoat();
|
||||
}
|
||||
|
||||
// Добавление установки
|
||||
@ -110,18 +128,21 @@ namespace ProjectBoat_bae
|
||||
|
||||
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_boat == null) return;
|
||||
if (_boat == null)
|
||||
return;
|
||||
switch (((Label)sender).Name)
|
||||
{
|
||||
case "labelColor":
|
||||
_boat.EntityBoat.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
case "LabelColor":
|
||||
_boat?.EntityBoat?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
case "labelAdditionalColor":
|
||||
if (_boat == null) return;
|
||||
(_boat.EntityBoat as EntityMotorBoat).setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||
case "LabelAdditionalColor":
|
||||
if (!(_boat is ProjectBoat_bae))
|
||||
return;
|
||||
(_boat.EntityBoat as EntityMotorBoat)?.setAdditionalColor(color:
|
||||
(Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
DrawBoat();
|
||||
}
|
||||
|
||||
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||
@ -153,10 +174,15 @@ namespace ProjectBoat_bae
|
||||
//Приведение к EntityTrolleybus для замены доп. цвета
|
||||
EntityMotorBoat? _motorboat = _boat.EntityBoat as EntityMotorBoat;
|
||||
_motorboat.setAdditionalColor(color);
|
||||
Draw();
|
||||
DrawBoat();
|
||||
}
|
||||
|
||||
private void LabelEasy_Click(object sender, EventArgs e)
|
||||
private void checkBoxBoat_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void labelSimpleObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user