diff --git a/ProjectAccordionBus/ProjectAccordionBus/BusDelegate.cs b/ProjectAccordionBus/ProjectAccordionBus/BusDelegate.cs new file mode 100644 index 0000000..320ad99 --- /dev/null +++ b/ProjectAccordionBus/ProjectAccordionBus/BusDelegate.cs @@ -0,0 +1,10 @@ +using ProjectAccordionBus.Drawnings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAccordionBus; + +public delegate void BusDelegate(DrawningBus bus); diff --git a/ProjectAccordionBus/ProjectAccordionBus/Entities/EntityAccordionBus.cs b/ProjectAccordionBus/ProjectAccordionBus/Entities/EntityAccordionBus.cs index ed7ce3c..c07ddbf 100644 --- a/ProjectAccordionBus/ProjectAccordionBus/Entities/EntityAccordionBus.cs +++ b/ProjectAccordionBus/ProjectAccordionBus/Entities/EntityAccordionBus.cs @@ -10,6 +10,8 @@ public class EntityAccordionBus : EntityBus { public Color AdditionalColor { get; private set; } + public void SetAdditionalColor(Color color) => AdditionalColor = color; + public bool Compartment { get; private set; } public bool Entrance { get; private set; } diff --git a/ProjectAccordionBus/ProjectAccordionBus/Entities/EntityBus.cs b/ProjectAccordionBus/ProjectAccordionBus/Entities/EntityBus.cs index 39b8765..ce1ec78 100644 --- a/ProjectAccordionBus/ProjectAccordionBus/Entities/EntityBus.cs +++ b/ProjectAccordionBus/ProjectAccordionBus/Entities/EntityBus.cs @@ -14,6 +14,8 @@ public class EntityBus public Color BodyColor { get; private set; } + public void SetBodyColor(Color color) => BodyColor = color; + public double Step => Speed * 50 / Weight; /// diff --git a/ProjectAccordionBus/ProjectAccordionBus/FormBusCollection.Designer.cs b/ProjectAccordionBus/ProjectAccordionBus/FormBusCollection.Designer.cs index 34c5ad3..c2920bc 100644 --- a/ProjectAccordionBus/ProjectAccordionBus/FormBusCollection.Designer.cs +++ b/ProjectAccordionBus/ProjectAccordionBus/FormBusCollection.Designer.cs @@ -32,7 +32,6 @@ panelCompanyTools = new Panel(); buttonDeleteBus = new Button(); maskedTextBox = new MaskedTextBox(); - buttonAddAccordionBus = new Button(); buttonRefresh = new Button(); buttonGoToCheck = new Button(); buttonAddBus = new Button(); @@ -69,7 +68,6 @@ // panelCompanyTools.Controls.Add(buttonDeleteBus); panelCompanyTools.Controls.Add(maskedTextBox); - panelCompanyTools.Controls.Add(buttonAddAccordionBus); panelCompanyTools.Controls.Add(buttonRefresh); panelCompanyTools.Controls.Add(buttonGoToCheck); panelCompanyTools.Controls.Add(buttonAddBus); @@ -102,17 +100,6 @@ maskedTextBox.ValidatingType = typeof(int); maskedTextBox.MaskInputRejected += maskedTextBox_MaskInputRejected; // - // buttonAddAccordionBus - // - buttonAddAccordionBus.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonAddAccordionBus.Location = new Point(6, 36); - buttonAddAccordionBus.Name = "buttonAddAccordionBus"; - buttonAddAccordionBus.Size = new Size(160, 38); - buttonAddAccordionBus.TabIndex = 3; - buttonAddAccordionBus.Text = "Добавление автобуса-гармошки"; - buttonAddAccordionBus.UseVisualStyleBackColor = true; - buttonAddAccordionBus.Click += buttonAddAccordionBus_Click; - // // buttonRefresh // buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; @@ -138,9 +125,9 @@ // buttonAddBus // buttonAddBus.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonAddBus.Location = new Point(6, 3); + buttonAddBus.Location = new Point(6, 17); buttonAddBus.Name = "buttonAddBus"; - buttonAddBus.Size = new Size(160, 27); + buttonAddBus.Size = new Size(160, 37); buttonAddBus.TabIndex = 2; buttonAddBus.Text = "Добавление автобуса"; buttonAddBus.UseVisualStyleBackColor = true; @@ -285,7 +272,6 @@ private GroupBox groupBoxTools; private ComboBox comboBoxSelectorCompany; - private Button buttonAddAccordionBus; private Button buttonAddBus; private PictureBox pictureBox; private Button buttonRefresh; diff --git a/ProjectAccordionBus/ProjectAccordionBus/FormBusCollection.cs b/ProjectAccordionBus/ProjectAccordionBus/FormBusCollection.cs index e03a472..abb8394 100644 --- a/ProjectAccordionBus/ProjectAccordionBus/FormBusCollection.cs +++ b/ProjectAccordionBus/ProjectAccordionBus/FormBusCollection.cs @@ -99,12 +99,26 @@ public partial class FormBusCollection : Form private void buttonAddBus_Click(object sender, EventArgs e) { - CreateObject(nameof(DrawningBus)); + FormBusConfig form = new(); + form.Show(); + form.AddEvent(SetBus); } - private void buttonAddAccordionBus_Click(object sender, EventArgs e) + private void SetBus(DrawningBus bus) { - CreateObject(nameof(DrawningAccordionBus)); + if (_company == null || bus == null) return; + + bus.SetPictureSize(pictureBox.Width, pictureBox.Height); + + if (_company + bus != -1) + { + MessageBox.Show("Объект добавлен"); + pictureBox.Image = _company.Show(); + } + else + { + MessageBox.Show("Объект не удалось добавить"); + } } private void buttonDeleteBus_Click(object sender, EventArgs e) diff --git a/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.Designer.cs b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.Designer.cs new file mode 100644 index 0000000..57fa9f4 --- /dev/null +++ b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.Designer.cs @@ -0,0 +1,376 @@ +namespace ProjectAccordionBus +{ + partial class FormBusConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + groupBoxConfig = new GroupBox(); + groupBoxColors = new GroupBox(); + panelPurple = new Panel(); + panelBlack = new Panel(); + panelYellow = new Panel(); + panelBlue = new Panel(); + panelGreen = new Panel(); + panelWhite = new Panel(); + panelGray = new Panel(); + panelRed = new Panel(); + checkBoxWindows = new CheckBox(); + checkBoxEntrance = new CheckBox(); + checkBoxCompartment = new CheckBox(); + numericUpDownWeight = new NumericUpDown(); + numericUpDownSpeed = new NumericUpDown(); + labelWeight = new Label(); + labelSpeed = new Label(); + labelModifiedObject = new Label(); + labelSimpleObject = new Label(); + pictureBoxObject = new PictureBox(); + buttonAdd = new Button(); + buttonCancel = new Button(); + panelObjects = new Panel(); + labelAdditionalColor = new Label(); + labelBodyColor = new Label(); + groupBoxConfig.SuspendLayout(); + groupBoxColors.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit(); + ((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit(); + panelObjects.SuspendLayout(); + SuspendLayout(); + // + // groupBoxConfig + // + groupBoxConfig.Controls.Add(groupBoxColors); + groupBoxConfig.Controls.Add(checkBoxWindows); + groupBoxConfig.Controls.Add(checkBoxEntrance); + groupBoxConfig.Controls.Add(checkBoxCompartment); + groupBoxConfig.Controls.Add(numericUpDownWeight); + groupBoxConfig.Controls.Add(numericUpDownSpeed); + groupBoxConfig.Controls.Add(labelWeight); + groupBoxConfig.Controls.Add(labelSpeed); + groupBoxConfig.Controls.Add(labelModifiedObject); + groupBoxConfig.Controls.Add(labelSimpleObject); + groupBoxConfig.Dock = DockStyle.Left; + groupBoxConfig.Location = new Point(0, 0); + groupBoxConfig.Name = "groupBoxConfig"; + groupBoxConfig.Size = new Size(479, 208); + groupBoxConfig.TabIndex = 0; + groupBoxConfig.TabStop = false; + groupBoxConfig.Text = "Параметры"; + // + // groupBoxColors + // + groupBoxColors.Controls.Add(panelPurple); + groupBoxColors.Controls.Add(panelBlack); + groupBoxColors.Controls.Add(panelYellow); + groupBoxColors.Controls.Add(panelBlue); + groupBoxColors.Controls.Add(panelGreen); + groupBoxColors.Controls.Add(panelWhite); + groupBoxColors.Controls.Add(panelGray); + groupBoxColors.Controls.Add(panelRed); + groupBoxColors.Location = new Point(211, 22); + groupBoxColors.Name = "groupBoxColors"; + groupBoxColors.Size = new Size(239, 130); + groupBoxColors.TabIndex = 9; + groupBoxColors.TabStop = false; + groupBoxColors.Text = "Цвета"; + // + // panelPurple + // + panelPurple.BackColor = Color.Purple; + panelPurple.Location = new Point(180, 73); + panelPurple.Name = "panelPurple"; + panelPurple.Size = new Size(38, 38); + panelPurple.TabIndex = 1; + // + // panelBlack + // + panelBlack.BackColor = Color.Black; + panelBlack.Location = new Point(123, 73); + panelBlack.Name = "panelBlack"; + panelBlack.Size = new Size(38, 38); + panelBlack.TabIndex = 1; + // + // panelYellow + // + panelYellow.BackColor = Color.Yellow; + panelYellow.Location = new Point(180, 22); + panelYellow.Name = "panelYellow"; + panelYellow.Size = new Size(38, 38); + panelYellow.TabIndex = 1; + // + // panelBlue + // + panelBlue.BackColor = Color.Blue; + panelBlue.Location = new Point(123, 22); + panelBlue.Name = "panelBlue"; + panelBlue.Size = new Size(38, 38); + panelBlue.TabIndex = 1; + // + // panelGreen + // + panelGreen.BackColor = Color.Green; + panelGreen.Location = new Point(69, 22); + panelGreen.Name = "panelGreen"; + panelGreen.Size = new Size(38, 38); + panelGreen.TabIndex = 1; + // + // panelWhite + // + panelWhite.BackColor = Color.White; + panelWhite.Location = new Point(13, 73); + panelWhite.Name = "panelWhite"; + panelWhite.Size = new Size(38, 38); + panelWhite.TabIndex = 1; + // + // panelGray + // + panelGray.BackColor = Color.Gray; + panelGray.Location = new Point(69, 73); + panelGray.Name = "panelGray"; + panelGray.Size = new Size(38, 38); + panelGray.TabIndex = 1; + // + // panelRed + // + panelRed.BackColor = Color.Red; + panelRed.Location = new Point(13, 22); + panelRed.Name = "panelRed"; + panelRed.Size = new Size(38, 38); + panelRed.TabIndex = 0; + // + // checkBoxWindows + // + checkBoxWindows.AutoSize = true; + checkBoxWindows.Location = new Point(6, 155); + checkBoxWindows.Name = "checkBoxWindows"; + checkBoxWindows.Size = new Size(153, 19); + checkBoxWindows.TabIndex = 8; + checkBoxWindows.Text = "Признак наличие окон"; + checkBoxWindows.UseVisualStyleBackColor = true; + // + // checkBoxEntrance + // + checkBoxEntrance.AutoSize = true; + checkBoxEntrance.Location = new Point(6, 120); + checkBoxEntrance.Name = "checkBoxEntrance"; + checkBoxEntrance.Size = new Size(158, 19); + checkBoxEntrance.TabIndex = 7; + checkBoxEntrance.Text = "Признак наличие двери"; + checkBoxEntrance.UseVisualStyleBackColor = true; + // + // checkBoxCompartment + // + checkBoxCompartment.AutoSize = true; + checkBoxCompartment.Location = new Point(6, 86); + checkBoxCompartment.Name = "checkBoxCompartment"; + checkBoxCompartment.Size = new Size(188, 19); + checkBoxCompartment.TabIndex = 6; + checkBoxCompartment.Text = "Признак наличие доп. отсека"; + checkBoxCompartment.UseVisualStyleBackColor = true; + // + // numericUpDownWeight + // + numericUpDownWeight.Location = new Point(74, 46); + 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(120, 23); + numericUpDownWeight.TabIndex = 5; + numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 }); + // + // numericUpDownSpeed + // + numericUpDownSpeed.Location = new Point(74, 17); + 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(120, 23); + numericUpDownSpeed.TabIndex = 4; + numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 }); + // + // labelWeight + // + labelWeight.AutoSize = true; + labelWeight.Location = new Point(6, 48); + labelWeight.Name = "labelWeight"; + labelWeight.Size = new Size(29, 15); + labelWeight.TabIndex = 3; + labelWeight.Text = "Вес:"; + // + // labelSpeed + // + labelSpeed.AutoSize = true; + labelSpeed.Location = new Point(6, 19); + labelSpeed.Name = "labelSpeed"; + labelSpeed.Size = new Size(62, 15); + labelSpeed.TabIndex = 2; + labelSpeed.Text = "Скорость:"; + // + // labelModifiedObject + // + labelModifiedObject.AllowDrop = true; + labelModifiedObject.BorderStyle = BorderStyle.FixedSingle; + labelModifiedObject.Location = new Point(350, 165); + labelModifiedObject.Name = "labelModifiedObject"; + labelModifiedObject.Size = new Size(100, 31); + labelModifiedObject.TabIndex = 1; + labelModifiedObject.Text = "Продвинутый"; + labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter; + labelModifiedObject.Click += buttonAdd_Click; + labelModifiedObject.MouseDown += labelObject_MouseDown; + // + // labelSimpleObject + // + labelSimpleObject.AllowDrop = true; + labelSimpleObject.BorderStyle = BorderStyle.FixedSingle; + labelSimpleObject.Location = new Point(224, 164); + labelSimpleObject.Name = "labelSimpleObject"; + labelSimpleObject.Size = new Size(100, 32); + labelSimpleObject.TabIndex = 0; + labelSimpleObject.Text = "Простой"; + labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter; + labelSimpleObject.Click += buttonAdd_Click; + labelSimpleObject.DragDrop += panelObject_DragDrop; + labelSimpleObject.DragEnter += panelObjects_DragEnter; + labelSimpleObject.MouseDown += labelObject_MouseDown; + // + // pictureBoxObject + // + pictureBoxObject.Location = new Point(19, 57); + pictureBoxObject.Name = "pictureBoxObject"; + pictureBoxObject.Size = new Size(173, 95); + pictureBoxObject.TabIndex = 1; + pictureBoxObject.TabStop = false; + // + // buttonAdd + // + buttonAdd.Location = new Point(504, 173); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(75, 23); + buttonAdd.TabIndex = 2; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(602, 173); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(75, 23); + buttonCancel.TabIndex = 3; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + // + // panelObjects + // + panelObjects.Controls.Add(labelAdditionalColor); + panelObjects.Controls.Add(labelBodyColor); + panelObjects.Controls.Add(pictureBoxObject); + panelObjects.Location = new Point(485, 0); + panelObjects.Name = "panelObjects"; + panelObjects.Size = new Size(204, 167); + panelObjects.TabIndex = 4; + panelObjects.DragDrop += panelObject_DragDrop; + panelObjects.DragEnter += panelObjects_DragEnter; + // + // labelAdditionalColor + // + labelAdditionalColor.AllowDrop = true; + labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle; + labelAdditionalColor.Location = new Point(117, 10); + labelAdditionalColor.Name = "labelAdditionalColor"; + labelAdditionalColor.Size = new Size(75, 32); + labelAdditionalColor.TabIndex = 3; + labelAdditionalColor.Text = "Доп. цвет"; + labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter; + labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop; + labelAdditionalColor.DragEnter += labelAdditionalColor_DragEnter; + // + // labelBodyColor + // + labelBodyColor.AllowDrop = true; + labelBodyColor.BorderStyle = BorderStyle.FixedSingle; + labelBodyColor.Location = new Point(19, 10); + labelBodyColor.Name = "labelBodyColor"; + labelBodyColor.Size = new Size(75, 32); + labelBodyColor.TabIndex = 2; + labelBodyColor.Text = "Цвет"; + labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; + labelBodyColor.Click += labelBodyColor_Click; + labelBodyColor.DragDrop += labelBodyColor_DragDrop; + labelBodyColor.DragEnter += labelBodyColor_DragEnter; + // + // FormBusConfig + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(689, 208); + Controls.Add(panelObjects); + Controls.Add(buttonAdd); + Controls.Add(buttonCancel); + Controls.Add(groupBoxConfig); + Name = "FormBusConfig"; + Text = "Создание объекта"; + groupBoxConfig.ResumeLayout(false); + groupBoxConfig.PerformLayout(); + groupBoxColors.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit(); + ((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit(); + panelObjects.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private GroupBox groupBoxConfig; + private Label labelModifiedObject; + private Label labelSimpleObject; + private NumericUpDown numericUpDownWeight; + private NumericUpDown numericUpDownSpeed; + private Label labelWeight; + private Label labelSpeed; + private CheckBox checkBoxCompartment; + private CheckBox checkBoxEntrance; + private CheckBox checkBoxWindows; + private GroupBox groupBoxColors; + private Panel panelPurple; + private Panel panelBlack; + private Panel panelYellow; + private Panel panelBlue; + private Panel panelGreen; + private Panel panelWhite; + private Panel panelGray; + private Panel panelRed; + private PictureBox pictureBoxObject; + private Button buttonAdd; + private Button buttonCancel; + private Panel panelObjects; + private Label labelAdditionalColor; + private Label labelBodyColor; + } +} \ No newline at end of file diff --git a/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.cs b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.cs new file mode 100644 index 0000000..f7dab15 --- /dev/null +++ b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.cs @@ -0,0 +1,171 @@ +using ProjectAccordionBus.Drawnings; +using ProjectAccordionBus.Entities; +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; + +namespace ProjectAccordionBus; + +public partial class FormBusConfig : Form +{ + /// + /// Объект прорисовки класса + /// + private DrawningBus? _bus; + + private event BusDelegate? _busDelegate; + + /// + /// Конструктор + /// + public FormBusConfig() + { + InitializeComponent(); + + panelRed.MouseDown += panel_MouseDown; + panelGreen.MouseDown += panel_MouseDown; + panelBlue.MouseDown += panel_MouseDown; + panelWhite.MouseDown += panel_MouseDown; + panelBlack.MouseDown += panel_MouseDown; + panelGray.MouseDown += panel_MouseDown; + panelPurple.MouseDown += panel_MouseDown; + panelYellow.MouseDown += panel_MouseDown; + + buttonCancel.Click += (sender, e) => Close(); + } + + public void AddEvent(BusDelegate busDelegate) + { + _busDelegate += busDelegate; + } + + // + /// Прорисовка объекта + /// + private void DrawObject() + { + Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height); + Graphics gr = Graphics.FromImage(bmp); + _bus?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height); + _bus?.SetPosition(15, 15); + _bus?.DrawTransport(gr); + pictureBoxObject.Image = bmp; + } + + /// + /// Передаем информацию при нажатии на Label + /// + /// + /// + private void labelObject_MouseDown(object sender, MouseEventArgs e) + { + (sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy); + } + + /// + /// Проверка получаемой информации (ее типа на соответствие требуемому) + /// + /// + /// + private void panelObjects_DragEnter(object sender, DragEventArgs e) + { + e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None; + } + + /// + /// Действия при приеме перетаскиваемой информации + /// + /// + /// + private void panelObject_DragDrop(object sender, DragEventArgs e) + { + switch (e.Data?.GetData(DataFormats.Text)?.ToString()) + { + case "labelSimpleObject": + _bus = new DrawningBus((int)numericUpDownSpeed.Value, + (double)numericUpDownWeight.Value, Color.White); + break; + case "labelModifiedObject": + _bus = new + DrawningAccordionBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, + Color.White, + Color.Black, checkBoxCompartment.Checked, + checkBoxEntrance.Checked, checkBoxWindows.Checked); + break; + } + labelBodyColor.BackColor = Color.Empty; + labelAdditionalColor.BackColor = Color.Empty; + DrawObject(); + } + + private void panel_MouseDown(object sender, MouseEventArgs e) + { + (sender as Control)?.DoDragDrop((sender as Control)?.BackColor ?? Color.Black, DragDropEffects.Move | DragDropEffects.Copy); + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + if (_bus != null) + { + _busDelegate?.Invoke(_bus); + Close(); + } + } + + private void labelBodyColor_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(typeof(Color))) + { + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; + } + } + + private void labelBodyColor_DragDrop(object sender, DragEventArgs e) + { + if (_bus != null) + { + _bus.EntityBus.SetBodyColor((Color)e.Data.GetData(typeof(Color))); + DrawObject(); + } + } + + private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e) + { + if (_bus is DrawningBus) + { + 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?.EntityBus is EntityAccordionBus _accordionBus) + { + _accordionBus.SetAdditionalColor((Color)e.Data.GetData(typeof(Color))); + } + DrawObject(); + + } + + private void labelBodyColor_Click(object sender, EventArgs e) + { + + } +} diff --git a/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.resx b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectAccordionBus/ProjectAccordionBus/FormBusConfig.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file