开发者

Control Drag Drop

开发者 https://www.devze.com 2023-03-22 02:11 出处:网络
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

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消