laba5 завершенная

This commit is contained in:
Extrimal 2023-11-28 16:36:02 +03:00
parent bf6fe472fc
commit a02e68e555

View File

@ -58,12 +58,6 @@ namespace AircraftCarrier
(sender as Label)?.DoDragDrop((sender as Label)?.Name, (sender as Label)?.DoDragDrop((sender as Label)?.Name,
DragDropEffects.Move | DragDropEffects.Copy); DragDropEffects.Move | DragDropEffects.Copy);
} }
private void panelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
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)
@ -75,17 +69,6 @@ namespace AircraftCarrier
e.Effect = DragDropEffects.None; e.Effect = DragDropEffects.None;
} }
} }
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 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())
@ -103,6 +86,25 @@ namespace AircraftCarrier
} }
DrawAircraft(); DrawAircraft();
} }
private void panelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
DragDropEffects.Move | DragDropEffects.Copy);
}
/// Проверка получаемой информации (ее типа на соответствие требуемому)
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 labelMainColor_DragDrop(object sender, DragEventArgs e) private void labelMainColor_DragDrop(object sender, DragEventArgs e)
{ {
if (_Aircraft == null) if (_Aircraft == null)