Control Drag Drop
I have a user control in c# o开发者_如何学运维n a windows form the drag drop events are only being fired around the edge of the control, does anyone have a clue what is causing this its driving me mad!?
private void flowDiagram1_DragEnter(object sender, DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.Text))
e.Effect = DragDropEffects.Move;
else
e.Effect = DragDropEffects.None;
}
private void flowDiagram1_DragOver(object sender, DragEventArgs e)
{
if (!m_bDragging)
flowDiagram1_DragDrop(sender, e);
}
private void flowDiagram1_DragDrop(object sender, DragEventArgs e)
{
MessageBox.Show("Drop");
}
I think you need to add this to drag over too:
if(e.Data.GetDataPresent(DataFormats.Text))
e.Effect = DragDropEffects.Move;
else
e.Effect = DragDropEffects.None;
精彩评论