DragDrop 拖曳至TextBox
private void textBox1_DragDrop(object sender, DragEventArgs e)
{
textBox1.Text = ((string[])e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
}
private void textBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.All;
}
else
{
e.Effect = DragDropEffects.None;
}
}
拖曳檔案進去就會看到一個+的符號
參考資料
http://msdn.microsoft.com/en-us/library/system.windows.forms.dragdropeffects(v=vs.71).aspx
大家一起加入blogads 賺零用錢!!