Lab4 Done
This commit is contained in:
parent
38a949a2ca
commit
de631fcdf5
11
Trolleybus/Trolleybus/BusDelegate.cs
Normal file
11
Trolleybus/Trolleybus/BusDelegate.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using ProjectTrolleybus.DrawingObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTrolleybus
|
||||
{
|
||||
public delegate void BusDelegate(DrawingBus bus);
|
||||
}
|
@ -10,6 +10,7 @@ using System.Windows.Forms;
|
||||
using ProjectTrolleybus.DrawingObjects;
|
||||
using ProjectTrolleybus.MovementStrategy;
|
||||
using ProjectTrolleybus.Generics;
|
||||
using ProjectTrolleybus;
|
||||
|
||||
namespace ProjectTrolleybus
|
||||
{
|
||||
@ -80,10 +81,11 @@ namespace ProjectTrolleybus
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormTrolleybus form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (obj + form.SelectedBus)
|
||||
FormBusConfig form = new FormBusConfig(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
form.Show();
|
||||
BusDelegate? busDelegate = new((m) => {
|
||||
bool q = (obj + m);
|
||||
if (q)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowBuses();
|
||||
@ -92,7 +94,8 @@ namespace ProjectTrolleybus
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
});
|
||||
form.AddEvent(busDelegate);
|
||||
}
|
||||
private void ButtonRemoveBus_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
365
Trolleybus/Trolleybus/FormBusConfig.Designer.cs
generated
Normal file
365
Trolleybus/Trolleybus/FormBusConfig.Designer.cs
generated
Normal file
@ -0,0 +1,365 @@
|
||||
namespace ProjectTrolleybus
|
||||
{
|
||||
partial class FormBusConfig
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
groupBoxConfig = new GroupBox();
|
||||
labelAdvanced = new Label();
|
||||
labelSimple = new Label();
|
||||
groupBoxColor = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelBlack = new Panel();
|
||||
panelGray = new Panel();
|
||||
panelWhite = new Panel();
|
||||
panelYellow = new Panel();
|
||||
panelBlue = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
checkBoxBattery = new CheckBox();
|
||||
checkBoxRoga = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
labelWeight = new Label();
|
||||
labelSpeed = new Label();
|
||||
panelAllow = new Panel();
|
||||
pictureBoxObject = new PictureBox();
|
||||
labelAdditionalColor = new Label();
|
||||
labelColor = new Label();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
groupBoxConfig.SuspendLayout();
|
||||
groupBoxColor.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
panelAllow.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxConfig
|
||||
//
|
||||
groupBoxConfig.Controls.Add(labelAdvanced);
|
||||
groupBoxConfig.Controls.Add(labelSimple);
|
||||
groupBoxConfig.Controls.Add(groupBoxColor);
|
||||
groupBoxConfig.Controls.Add(checkBoxBattery);
|
||||
groupBoxConfig.Controls.Add(checkBoxRoga);
|
||||
groupBoxConfig.Controls.Add(numericUpDownWeight);
|
||||
groupBoxConfig.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxConfig.Controls.Add(labelWeight);
|
||||
groupBoxConfig.Controls.Add(labelSpeed);
|
||||
groupBoxConfig.Location = new Point(12, 12);
|
||||
groupBoxConfig.Name = "groupBoxConfig";
|
||||
groupBoxConfig.Size = new Size(737, 337);
|
||||
groupBoxConfig.TabIndex = 0;
|
||||
groupBoxConfig.TabStop = false;
|
||||
groupBoxConfig.Text = "Параметры";
|
||||
//
|
||||
// labelAdvanced
|
||||
//
|
||||
labelAdvanced.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdvanced.Location = new Point(574, 262);
|
||||
labelAdvanced.Name = "labelAdvanced";
|
||||
labelAdvanced.Size = new Size(120, 52);
|
||||
labelAdvanced.TabIndex = 8;
|
||||
labelAdvanced.Text = "Продвинутый";
|
||||
labelAdvanced.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdvanced.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// labelSimple
|
||||
//
|
||||
labelSimple.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimple.Location = new Point(443, 262);
|
||||
labelSimple.Name = "labelSimple";
|
||||
labelSimple.Size = new Size(116, 52);
|
||||
labelSimple.TabIndex = 7;
|
||||
labelSimple.Text = "Простой";
|
||||
labelSimple.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimple.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// groupBoxColor
|
||||
//
|
||||
groupBoxColor.Controls.Add(panelPurple);
|
||||
groupBoxColor.Controls.Add(panelBlack);
|
||||
groupBoxColor.Controls.Add(panelGray);
|
||||
groupBoxColor.Controls.Add(panelWhite);
|
||||
groupBoxColor.Controls.Add(panelYellow);
|
||||
groupBoxColor.Controls.Add(panelBlue);
|
||||
groupBoxColor.Controls.Add(panelGreen);
|
||||
groupBoxColor.Controls.Add(panelRed);
|
||||
groupBoxColor.Location = new Point(411, 53);
|
||||
groupBoxColor.Name = "groupBoxColor";
|
||||
groupBoxColor.Size = new Size(306, 182);
|
||||
groupBoxColor.TabIndex = 6;
|
||||
groupBoxColor.TabStop = false;
|
||||
groupBoxColor.Text = "Цвета";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.Purple;
|
||||
panelPurple.Location = new Point(236, 98);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(58, 49);
|
||||
panelPurple.TabIndex = 1;
|
||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(163, 98);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(58, 49);
|
||||
panelBlack.TabIndex = 1;
|
||||
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
panelGray.BackColor = Color.Gray;
|
||||
panelGray.Location = new Point(90, 98);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(58, 49);
|
||||
panelGray.TabIndex = 1;
|
||||
panelGray.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.BackColor = Color.White;
|
||||
panelWhite.Location = new Point(15, 98);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(58, 49);
|
||||
panelWhite.TabIndex = 1;
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.BackColor = Color.Yellow;
|
||||
panelYellow.Location = new Point(236, 33);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(58, 49);
|
||||
panelYellow.TabIndex = 1;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.BackColor = Color.Blue;
|
||||
panelBlue.Location = new Point(163, 33);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(58, 49);
|
||||
panelBlue.TabIndex = 1;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.Green;
|
||||
panelGreen.Location = new Point(90, 33);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(58, 49);
|
||||
panelGreen.TabIndex = 1;
|
||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.BackColor = Color.Red;
|
||||
panelRed.Location = new Point(15, 33);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(58, 49);
|
||||
panelRed.TabIndex = 0;
|
||||
panelRed.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// checkBoxBattery
|
||||
//
|
||||
checkBoxBattery.AutoSize = true;
|
||||
checkBoxBattery.Location = new Point(6, 214);
|
||||
checkBoxBattery.Name = "checkBoxBattery";
|
||||
checkBoxBattery.Size = new Size(399, 24);
|
||||
checkBoxBattery.TabIndex = 5;
|
||||
checkBoxBattery.Text = "Признак наличия отсека под электрические батареи";
|
||||
checkBoxBattery.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxRoga
|
||||
//
|
||||
checkBoxRoga.AutoSize = true;
|
||||
checkBoxRoga.Location = new Point(6, 171);
|
||||
checkBoxRoga.Name = "checkBoxRoga";
|
||||
checkBoxRoga.Size = new Size(277, 24);
|
||||
checkBoxRoga.TabIndex = 4;
|
||||
checkBoxRoga.Text = "Признак наличия токоприёмников";
|
||||
checkBoxRoga.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(102, 111);
|
||||
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(150, 27);
|
||||
numericUpDownWeight.TabIndex = 3;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(102, 53);
|
||||
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(150, 27);
|
||||
numericUpDownSpeed.TabIndex = 2;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
labelWeight.AutoSize = true;
|
||||
labelWeight.Location = new Point(6, 113);
|
||||
labelWeight.Name = "labelWeight";
|
||||
labelWeight.Size = new Size(36, 20);
|
||||
labelWeight.TabIndex = 1;
|
||||
labelWeight.Text = "Вес:";
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(6, 55);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(76, 20);
|
||||
labelSpeed.TabIndex = 0;
|
||||
labelSpeed.Text = "Скорость:";
|
||||
//
|
||||
// panelAllow
|
||||
//
|
||||
panelAllow.AllowDrop = true;
|
||||
panelAllow.Controls.Add(pictureBoxObject);
|
||||
panelAllow.Controls.Add(labelAdditionalColor);
|
||||
panelAllow.Controls.Add(labelColor);
|
||||
panelAllow.Location = new Point(755, 12);
|
||||
panelAllow.Name = "panelAllow";
|
||||
panelAllow.Size = new Size(362, 292);
|
||||
panelAllow.TabIndex = 1;
|
||||
panelAllow.DragDrop += PanelObject_DragDrop;
|
||||
panelAllow.DragEnter += PanelObject_DragEnter;
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(61, 86);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(227, 161);
|
||||
pictureBoxObject.TabIndex = 2;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// labelAdditionalColor
|
||||
//
|
||||
labelAdditionalColor.AllowDrop = true;
|
||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new Point(200, 13);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
labelAdditionalColor.Size = new Size(129, 49);
|
||||
labelAdditionalColor.TabIndex = 1;
|
||||
labelAdditionalColor.Text = "Доп. цвет";
|
||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop;
|
||||
labelAdditionalColor.DragEnter += labelAdditionalColor_DragEnter;
|
||||
//
|
||||
// labelColor
|
||||
//
|
||||
labelColor.AllowDrop = true;
|
||||
labelColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelColor.Location = new Point(26, 13);
|
||||
labelColor.Name = "labelColor";
|
||||
labelColor.Size = new Size(142, 49);
|
||||
labelColor.TabIndex = 0;
|
||||
labelColor.Text = "Цвет";
|
||||
labelColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelColor.DragDrop += labelColor_DragDrop;
|
||||
labelColor.DragEnter += labelColor_DragEnter;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(781, 321);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(142, 45);
|
||||
buttonAdd.TabIndex = 2;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonOk_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(955, 321);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(129, 45);
|
||||
buttonCancel.TabIndex = 3;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormBusConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1123, 386);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(panelAllow);
|
||||
Controls.Add(groupBoxConfig);
|
||||
Name = "FormBusConfig";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Создание объекта";
|
||||
groupBoxConfig.ResumeLayout(false);
|
||||
groupBoxConfig.PerformLayout();
|
||||
groupBoxColor.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
panelAllow.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxConfig;
|
||||
private Label labelSpeed;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Label labelWeight;
|
||||
private GroupBox groupBoxColor;
|
||||
private CheckBox checkBoxBattery;
|
||||
private CheckBox checkBoxRoga;
|
||||
private Panel panelPurple;
|
||||
private Panel panelBlack;
|
||||
private Panel panelGray;
|
||||
private Panel panelWhite;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlue;
|
||||
private Panel panelGreen;
|
||||
private Panel panelRed;
|
||||
private Label labelAdvanced;
|
||||
private Label labelSimple;
|
||||
private Panel panelAllow;
|
||||
private Label labelColor;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Label labelAdditionalColor;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
160
Trolleybus/Trolleybus/FormBusConfig.cs
Normal file
160
Trolleybus/Trolleybus/FormBusConfig.cs
Normal file
@ -0,0 +1,160 @@
|
||||
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 ProjectTrolleybus.DrawingObjects;
|
||||
using ProjectTrolleybus.Entities;
|
||||
|
||||
namespace ProjectTrolleybus
|
||||
{
|
||||
public partial class FormBusConfig : Form
|
||||
{
|
||||
private readonly int PictureWidth;
|
||||
private readonly int PictureHeight;
|
||||
|
||||
DrawingBus? _bus = null;
|
||||
|
||||
private event BusDelegate? EventAddBus;
|
||||
|
||||
public FormBusConfig(int Width, int Height)
|
||||
{
|
||||
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 += (s, e) => Close();
|
||||
PictureWidth = Width;
|
||||
PictureHeight = Height;
|
||||
}
|
||||
|
||||
private void DrawBus()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_bus?.SetPosition(5, 5); _bus?.DrawTransport(gr); pictureBoxObject.Image = bmp;
|
||||
}
|
||||
|
||||
public void AddEvent(BusDelegate ev)
|
||||
{
|
||||
if (EventAddBus == null)
|
||||
{
|
||||
EventAddBus = ev;
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddBus += ev;
|
||||
}
|
||||
}
|
||||
|
||||
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 "labelSimple":
|
||||
_bus = new DrawingBus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, PictureWidth, PictureHeight); break;
|
||||
case "labelAdvanced":
|
||||
_bus = new DrawingTrolleybus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxRoga.Checked, checkBoxBattery.Checked, PictureWidth, PictureHeight); break;
|
||||
}
|
||||
DrawBus();
|
||||
}
|
||||
|
||||
private void PanelColor_MouseDown(object? sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||
DragDropEffects.Move | DragDropEffects.Copy);
|
||||
|
||||
}
|
||||
|
||||
private void ButtonOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_bus == null)
|
||||
return;
|
||||
EventAddBus?.Invoke(_bus);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_bus == null || _bus.EntityBus == null || _bus is DrawingTrolleybus == false)
|
||||
return;
|
||||
Color colorAdditional = (Color)e.Data.GetData(typeof(Color));
|
||||
_bus = new DrawingTrolleybus(_bus.EntityBus.Speed, _bus.EntityBus.Weight,
|
||||
_bus.EntityBus.BodyColor, colorAdditional, ((EntityTrolleybus)_bus.EntityBus).Roga,
|
||||
((EntityTrolleybus)_bus.EntityBus).Battery, PictureWidth, PictureHeight);
|
||||
DrawBus();
|
||||
}
|
||||
|
||||
private void labelColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_bus == null || _bus.EntityBus == null)
|
||||
return;
|
||||
Color color = (Color)e.Data.GetData(typeof(Color));
|
||||
if (_bus is DrawingTrolleybus == false)
|
||||
{
|
||||
_bus = new DrawingBus(_bus.EntityBus.Speed, _bus.EntityBus.Weight,
|
||||
color, PictureWidth, PictureHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
_bus = new DrawingTrolleybus(_bus.EntityBus.Speed, _bus.EntityBus.Weight,
|
||||
color, ((EntityTrolleybus)_bus.EntityBus).AdditionalColor, ((EntityTrolleybus)_bus.EntityBus).Roga,
|
||||
((EntityTrolleybus)_bus.EntityBus).Battery, PictureWidth, PictureHeight);
|
||||
|
||||
}
|
||||
DrawBus();
|
||||
}
|
||||
|
||||
private void labelColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
120
Trolleybus/Trolleybus/FormBusConfig.resx
Normal file
120
Trolleybus/Trolleybus/FormBusConfig.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>
|
8
Trolleybus/Trolleybus/FormTrolleybus.Designer.cs
generated
8
Trolleybus/Trolleybus/FormTrolleybus.Designer.cs
generated
@ -55,7 +55,7 @@
|
||||
// buttonRight
|
||||
//
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = Trolleybus.Properties.Resources.Right;
|
||||
buttonRight.BackgroundImage = ProjectTrolleybus.Properties.Resources.Right;
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonRight.Location = new Point(842, 419);
|
||||
buttonRight.Name = "buttonRight";
|
||||
@ -67,7 +67,7 @@
|
||||
// buttonDown
|
||||
//
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = Trolleybus.Properties.Resources.Down;
|
||||
buttonDown.BackgroundImage = ProjectTrolleybus.Properties.Resources.Down;
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonDown.Location = new Point(806, 419);
|
||||
buttonDown.Name = "buttonDown";
|
||||
@ -79,7 +79,7 @@
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = Trolleybus.Properties.Resources.Left;
|
||||
buttonLeft.BackgroundImage = ProjectTrolleybus.Properties.Resources.Left;
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonLeft.Location = new Point(770, 419);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
@ -91,7 +91,7 @@
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = Trolleybus.Properties.Resources.Up;
|
||||
buttonUp.BackgroundImage = ProjectTrolleybus.Properties.Resources.Up;
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUp.Location = new Point(806, 383);
|
||||
buttonUp.Name = "buttonUp";
|
||||
|
@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Trolleybus.Properties {
|
||||
namespace ProjectTrolleybus.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user