아마르는
타이라니드가 언급 한 바와 같이
은 "보낸 사람"이벤트를 트리거 컨트롤입니다. 이 컨트롤은 드래그를 시작한 컨트롤이 아니라 드래그를 수락 한 컨트롤입니다.
예 :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
/// <summary>
/// There's button 1 and button 2... button 1 is meant to start the dragging. Button 2 is meant to accept it
/// </summary>
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/// <summary>
/// This is when button 1 starts the drag
/// </summary>
private void button1_MouseDown(object sender, MouseEventArgs e)
{
this.DoDragDrop(this, DragDropEffects.Copy);
}
/// <summary>
/// This is when button 2 accepts the drag
/// </summary>
private void button2_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
/// <summary>
/// This is when the drop happens
/// </summary>
private void button2_DragDrop(object sender, DragEventArgs e)
{
// sender is always button2
}
}
}
송신기 파라미터는 이벤트를 전송 제어 (즉, 트 리뷰) 누가되지 드래그 드롭을 시작으로 수행이기 때문이다. – tyranid