зафиксировать всё
This commit is contained in:
parent
b15bf7d2c0
commit
568f6fe9ed
@ -6,7 +6,6 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using ProjectBoat_bae;
|
||||
using ProjectBoat_bae.Entities;
|
||||
using ProjectBoat_bae.MovementStrategy;
|
||||
|
||||
@ -22,10 +21,10 @@ namespace ProjectBoat_bae.DrawningObjects
|
||||
public EntityBoat? EntityBoat { get; protected set; }
|
||||
|
||||
// Ширина окна
|
||||
private int _pictureWidth;
|
||||
public int _pictureWidth;
|
||||
|
||||
// Высота окна
|
||||
private int _pictureHeight;
|
||||
public int _pictureHeight;
|
||||
|
||||
// Левая координата прорисовки
|
||||
protected int _startPosX;
|
||||
@ -163,5 +162,11 @@ namespace ProjectBoat_bae.DrawningObjects
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangePictureSize(int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,11 @@ namespace ProjectBoat_bae.Entities
|
||||
{
|
||||
public class EntityBoat
|
||||
{
|
||||
|
||||
public void SetBodyColor(Color color)
|
||||
{
|
||||
BodyColor = color;
|
||||
}
|
||||
|
||||
public int Speed { get; private set; }
|
||||
public double Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
|
@ -8,6 +8,11 @@ namespace ProjectBoat_bae.Entities
|
||||
{
|
||||
public class EntityMotorBoat : EntityBoat
|
||||
{
|
||||
public void setAdditionalColor(Color color)
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public bool Body { get; private set; }
|
||||
public bool Wing { get; private set; }
|
||||
|
@ -4,7 +4,6 @@ using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@ -79,27 +78,32 @@ namespace ProjectBoat_bae
|
||||
// Добавление объекта в набор
|
||||
private void ButtonAddBoat_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (listBoxStorages.SelectedIndex == -1) return;
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
if (obj == null) return;
|
||||
|
||||
FormBoatConfig form = new FormBoatConfig();
|
||||
|
||||
form.AddEvent(AddBoat);
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private void AddBoat(Drawningboat boat)
|
||||
{
|
||||
boat._pictureWidth = pictureBoxCollection.Width;
|
||||
boat._pictureHeight = pictureBoxCollection.Height;
|
||||
if (listBoxStorages.SelectedIndex == -1) return;
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null) return;
|
||||
|
||||
if (obj + boat)
|
||||
{
|
||||
return;
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowBoats();
|
||||
}
|
||||
FormBoat form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
else
|
||||
{
|
||||
if (obj + form.SelectedBoat)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowBoats();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
|
376
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.Designer.cs
generated
Normal file
376
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.Designer.cs
generated
Normal file
@ -0,0 +1,376 @@
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
partial class FormBoatConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
pictureBoxObject = new PictureBox();
|
||||
groupBoxBoat = new GroupBox();
|
||||
labelModifiedObject = new Label();
|
||||
LabelEasy = new Label();
|
||||
groupBoxColors = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelGray = new Panel();
|
||||
panelWhite = new Panel();
|
||||
panelBlack = new Panel();
|
||||
panelYellow = new Panel();
|
||||
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();
|
||||
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();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(38, 76);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(388, 282);
|
||||
pictureBoxObject.TabIndex = 0;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// groupBoxBoat
|
||||
//
|
||||
groupBoxBoat.Controls.Add(labelModifiedObject);
|
||||
groupBoxBoat.Controls.Add(LabelEasy);
|
||||
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);
|
||||
groupBoxBoat.Name = "groupBoxBoat";
|
||||
groupBoxBoat.Size = new Size(668, 449);
|
||||
groupBoxBoat.TabIndex = 1;
|
||||
groupBoxBoat.TabStop = false;
|
||||
groupBoxBoat.Text = "Параметры";
|
||||
//
|
||||
// labelModifiedObject
|
||||
//
|
||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelModifiedObject.Location = new Point(464, 227);
|
||||
labelModifiedObject.Name = "labelModifiedObject";
|
||||
labelModifiedObject.Size = new Size(138, 38);
|
||||
labelModifiedObject.TabIndex = 11;
|
||||
labelModifiedObject.Text = "Продвинутый";
|
||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// LabelEasy
|
||||
//
|
||||
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;
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
groupBoxColors.Controls.Add(panelPurple);
|
||||
groupBoxColors.Controls.Add(panelGray);
|
||||
groupBoxColors.Controls.Add(panelWhite);
|
||||
groupBoxColors.Controls.Add(panelBlack);
|
||||
groupBoxColors.Controls.Add(panelYellow);
|
||||
groupBoxColors.Controls.Add(panelBlue);
|
||||
groupBoxColors.Controls.Add(panelGreen);
|
||||
groupBoxColors.Controls.Add(panelRed);
|
||||
groupBoxColors.Location = new Point(334, 30);
|
||||
groupBoxColors.Name = "groupBoxColors";
|
||||
groupBoxColors.Size = new Size(268, 175);
|
||||
groupBoxColors.TabIndex = 9;
|
||||
groupBoxColors.TabStop = false;
|
||||
groupBoxColors.Text = "Цвета";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.FromArgb(192, 0, 192);
|
||||
panelPurple.Location = new Point(205, 109);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(45, 45);
|
||||
panelPurple.TabIndex = 11;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
panelGray.BackColor = Color.Gray;
|
||||
panelGray.Location = new Point(144, 109);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(45, 45);
|
||||
panelGray.TabIndex = 11;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.BackColor = Color.White;
|
||||
panelWhite.Location = new Point(79, 109);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(45, 45);
|
||||
panelWhite.TabIndex = 11;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(17, 109);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(45, 45);
|
||||
panelBlack.TabIndex = 11;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.BackColor = Color.Yellow;
|
||||
panelYellow.Location = new Point(205, 45);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(45, 45);
|
||||
panelYellow.TabIndex = 11;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.BackColor = Color.Navy;
|
||||
panelBlue.Location = new Point(144, 45);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(45, 45);
|
||||
panelBlue.TabIndex = 11;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.FromArgb(0, 64, 0);
|
||||
panelGreen.Location = new Point(79, 45);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(45, 45);
|
||||
panelGreen.TabIndex = 11;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.BackColor = Color.FromArgb(192, 0, 0);
|
||||
panelRed.Location = new Point(17, 45);
|
||||
panelRed.Name = "panelRed";
|
||||
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);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(90, 31);
|
||||
numericUpDownSpeed.TabIndex = 4;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(148, 104);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(90, 31);
|
||||
numericUpDownWeight.TabIndex = 5;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// Speed
|
||||
//
|
||||
Speed.AutoSize = true;
|
||||
Speed.Location = new Point(21, 61);
|
||||
Speed.Name = "Speed";
|
||||
Speed.Size = new Size(89, 25);
|
||||
Speed.TabIndex = 2;
|
||||
Speed.Text = "Скорость";
|
||||
//
|
||||
// checkBoxBoat
|
||||
//
|
||||
checkBoxBoat.AutoSize = true;
|
||||
checkBoxBoat.Location = new Point(21, 176);
|
||||
checkBoxBoat.Name = "checkBoxBoat";
|
||||
checkBoxBoat.Size = new Size(180, 29);
|
||||
checkBoxBoat.TabIndex = 6;
|
||||
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;
|
||||
//
|
||||
// Weight
|
||||
//
|
||||
Weight.AutoSize = true;
|
||||
Weight.Location = new Point(21, 104);
|
||||
Weight.Name = "Weight";
|
||||
Weight.Size = new Size(39, 25);
|
||||
Weight.TabIndex = 3;
|
||||
Weight.Text = "Вес";
|
||||
//
|
||||
// Panelcolor
|
||||
//
|
||||
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;
|
||||
//
|
||||
// AddColorbutton
|
||||
//
|
||||
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 = "Доп. цвет";
|
||||
//
|
||||
// Colorlabel
|
||||
//
|
||||
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 = "Цвет";
|
||||
//
|
||||
// buttonOk
|
||||
//
|
||||
buttonOk.Location = new Point(696, 418);
|
||||
buttonOk.Name = "buttonOk";
|
||||
buttonOk.Size = new Size(216, 43);
|
||||
buttonOk.TabIndex = 0;
|
||||
buttonOk.Text = "Добавить";
|
||||
buttonOk.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(940, 418);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(216, 43);
|
||||
buttonCancel.TabIndex = 3;
|
||||
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);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1178, 498);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonOk);
|
||||
Controls.Add(Panelcolor);
|
||||
Controls.Add(groupBoxBoat);
|
||||
Name = "FormBoatConfig";
|
||||
Text = "FormBoatConfig";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
groupBoxBoat.ResumeLayout(false);
|
||||
groupBoxBoat.PerformLayout();
|
||||
groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
Panelcolor.ResumeLayout(false);
|
||||
Panelcolor.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxObject;
|
||||
private GroupBox groupBoxBoat;
|
||||
private Label Speed;
|
||||
private Label Weight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private GroupBox groupBoxColors;
|
||||
private CheckBox checkBox3;
|
||||
private CheckBox checkBoxBoat;
|
||||
private CheckBox checkBoxRainforce;
|
||||
private Label LabelEasy;
|
||||
private Panel panelPurple;
|
||||
private Panel panelGray;
|
||||
private Panel panelWhite;
|
||||
private Panel panelBlack;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlue;
|
||||
private Panel panelGreen;
|
||||
private Panel panelRed;
|
||||
private Label labelModifiedObject;
|
||||
private Panel Panelcolor;
|
||||
private Button buttonOk;
|
||||
private Button buttonCancel;
|
||||
private Label AddColorbutton;
|
||||
private Label Colorlabel;
|
||||
private PictureBox pictureBox1;
|
||||
}
|
||||
}
|
164
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.cs
Normal file
164
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.cs
Normal file
@ -0,0 +1,164 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
using ProjectBoat_bae.Entities;
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
public partial class FormBoatConfig : Form
|
||||
{
|
||||
|
||||
// Переменная-выбранная лодка
|
||||
public Drawningboat? _boat = null;
|
||||
|
||||
// Событие
|
||||
private event Action<Drawningboat>? EventAddBoat;
|
||||
|
||||
// Добавление события
|
||||
public void AddEvent(Action<Drawningboat> ev)
|
||||
{
|
||||
if (EventAddBoat == null)
|
||||
{
|
||||
EventAddBoat = ev;
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddBoat += ev;
|
||||
}
|
||||
}
|
||||
|
||||
// Конструктор
|
||||
public FormBoatConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||
panelGray.MouseDown += PanelColor_MouseDown;
|
||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||
panelRed.MouseDown += PanelColor_MouseDown;
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
}
|
||||
|
||||
// Метод прорисовки
|
||||
private void Draw()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_boat?.SetPosition(5, 5);
|
||||
_boat?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
|
||||
// Передаем информацию при нажатии на Label
|
||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
// Действия при приеме перетаскиваемой информации
|
||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelEasy":
|
||||
_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);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
// Добавление установки
|
||||
private void buttonOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
EventAddBoat?.Invoke(_boat);
|
||||
Close();
|
||||
}
|
||||
|
||||
// Отправляем цвет с панели
|
||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||
DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_boat == null) return;
|
||||
switch (((Label)sender).Name)
|
||||
{
|
||||
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)));
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)) && _boat != null && _boat is Drawningboat)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
var color = (Color)e.Data.GetData(typeof(Color));
|
||||
//Приведение к EntityTrolleybus для замены доп. цвета
|
||||
EntityMotorBoat? _motorboat = _boat.EntityBoat as EntityMotorBoat;
|
||||
_motorboat.setAdditionalColor(color);
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void LabelEasy_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.resx
Normal file
120
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Loading…
x
Reference in New Issue
Block a user