после доп задания
This commit is contained in:
parent
4c85daa81d
commit
c17430f76d
@ -65,34 +65,12 @@ namespace Lab1ContainersShip
|
|||||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
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)
|
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;
|
e.Effect = DragDropEffects.Copy;
|
||||||
}
|
}
|
||||||
@ -100,14 +78,14 @@ namespace Lab1ContainersShip
|
|||||||
{
|
{
|
||||||
e.Effect = DragDropEffects.None;
|
e.Effect = DragDropEffects.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
/*switch (e.Data?.GetData(DataFormats.Text).ToString())
|
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||||
{
|
{
|
||||||
case "labelSimpleObject":
|
case "labelSimpleObject":
|
||||||
_ship =
|
_ship = new DrawingShip((int)numericUpDownSpeed.Value,
|
||||||
new DrawingShip((int)numericUpDownSpeed.Value,
|
|
||||||
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
|
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
|
||||||
pictureBoxObject.Height);
|
pictureBoxObject.Height);
|
||||||
break;
|
break;
|
||||||
@ -116,18 +94,7 @@ namespace Lab1ContainersShip
|
|||||||
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxCrane.Checked,
|
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxCrane.Checked,
|
||||||
checkBoxContainers.Checked, pictureBoxObject.Width,pictureBoxObject.Height);
|
checkBoxContainers.Checked, pictureBoxObject.Width,pictureBoxObject.Height);
|
||||||
break;
|
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();
|
DrawShip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user