Подскажите пожалуйста как можно это сделать ...
| Код | using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;
namespace TLPDragDrop { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void panel1_MouseDown(object sender, MouseEventArgs e) { Panel PanelCard = sender as Panel; //PanelCard.Tag = tableLayoutPanel1.GetCellPosition(PanelCard); //PanelCard.Tag = new Point(e.X, e.Y);
PanelCard.DoDragDrop(sender, DragDropEffects.Move); }
private void tableLayoutPanel1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(Panel))) e.Effect = DragDropEffects.Move; }
private void tableLayoutPanel1_DragDrop(object sender, DragEventArgs e) { Panel PanelCard = (Panel)e.Data.GetData(typeof(Panel)); // Вот кок раз здесь нужно и знать в какую ячейку бросили контрол ... } } }
|
|