必要条件:一个属性,2个事件


public UccFormChat() {
InitializeComponent();
this.chatView.InitControl();
InitializeViewEvent();
this.ribbonControl1.QAT.Hidden = true;
this.DoubleBuffered = true;
this.AllowDrop = true;
this.DragEnter += new DragEventHandler(UccFormChat_DragEnter);
this.DragDrop += new DragEventHandler(_OutputBox_DragDrop);
}
void UccFormChat_DragEnter(object sender, DragEventArgs e) {
e.Effect = DragDropEffects.Copy;
}
void _OutputBox_DragDrop(object sender, DragEventArgs e) {
foreach (string file in ((System.Array)e.Data.GetData(DataFormats.FileDrop))) {
MessageBox.Show(file);
}
}