о
This commit is contained in:
parent
5bb1d850e7
commit
4c85daa81d
@ -20,8 +20,9 @@ namespace Lab1ContainersShip
|
||||
/// Событие
|
||||
/// </summary>
|
||||
|
||||
private event ShipDelegate EventAddShip;
|
||||
public void AddEvent(ShipDelegate ev)
|
||||
|
||||
private event Action<DrawingShip> EventAddShip;
|
||||
public void AddEvent(Action<DrawingShip> ev)
|
||||
{
|
||||
if (EventAddShip == null)
|
||||
{
|
||||
@ -63,11 +64,35 @@ namespace Lab1ContainersShip
|
||||
|
||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name,DragDropEffects.Move | DragDropEffects.Copy);
|
||||
|
||||
//(sender as Label)?.DoDragDrop((sender as Label)?.Name,DragDropEffects.Move | DragDropEffects.Copy);
|
||||
if((sender as Label).Name == "labelSimpleObject")
|
||||
{_ship = new DrawingShip((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
|
||||
pictureBoxObject.Height);
|
||||
}
|
||||
else {
|
||||
_ship = new DrawingContainerShip((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxCrane.Checked,
|
||||
checkBoxContainers.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
}
|
||||
DoDragDrop(_ship, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
/*if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}*/
|
||||
if (e.Data?.GetDataPresent(typeof(DrawingShip)) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else if (e.Data?.GetDataPresent(typeof(DrawingContainerShip)) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
@ -78,10 +103,11 @@ namespace Lab1ContainersShip
|
||||
}
|
||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
/*switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelSimpleObject":
|
||||
_ship = new DrawingShip((int)numericUpDownSpeed.Value,
|
||||
_ship =
|
||||
new DrawingShip((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
|
||||
pictureBoxObject.Height);
|
||||
break;
|
||||
@ -90,7 +116,18 @@ namespace Lab1ContainersShip
|
||||
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxCrane.Checked,
|
||||
checkBoxContainers.Checked, pictureBoxObject.Width,pictureBoxObject.Height);
|
||||
break;
|
||||
}*/
|
||||
var eeee = e.Data?.GetData(typeof(DrawingShip));
|
||||
var gggg = e.Data?.GetData(typeof(DrawingContainerShip));
|
||||
if(eeee != null)
|
||||
{
|
||||
_ship = (DrawingShip)eeee;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ship = (DrawingContainerShip)gggg;
|
||||
}
|
||||
|
||||
DrawShip();
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,6 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SetGeneric.cs" />
|
||||
<Compile Include="ShipGenericStorage.cs" />
|
||||
<Compile Include="ShipDelegate.cs" />
|
||||
<Compile Include="Status.cs" />
|
||||
<EmbeddedResource Include="FormContainerShip.resx">
|
||||
<DependentUpon>FormContainerShip.cs</DependentUpon>
|
||||
|
@ -1,12 +0,0 @@
|
||||
using Lab1ContainersShip.DrawingObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Lab1ContainersShip
|
||||
{
|
||||
public delegate void ShipDelegate(DrawingShip ship);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user