WinForm的鼠標拖拽功能
功能
思路
窗體的AllowDrop屬性必須設置成true
且必須有DragEnter事件(單獨寫DragDrop事件是不會具有拖拽功能的)
畫面的Designer Code(frmMain
//
// frmMain
//
this
this
this
//
// dgv
//
this
this
this
重要代碼
(注
WinForm&DataGridView事件
#region DragEnter(Form&DataGridView)
/// <summary>
/// DragEnter
/// </summary>
/// <param name=
/// <param name=
private void frmMain_DragEnter(object sender
{
//以下の文がなければ
e
}
#endregion
#region DragDrop(Form&DataGridView)
/// <summary>
/// DragDrop
/// </summary>
/// <param name=
/// <param name=
private void frmMain_DragDrop(object sender
{
DataDisplay(e);
this
}
#endregion
From:http://tw.wingwit.com/Article/program/net/201311/11510.html