美文网首页
C# winform实现文件拖拽功能

C# winform实现文件拖拽功能

作者: Rinaloving | 来源:发表于2018-12-24 18:01 被阅读0次

private void txtAppPath_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Link;
}
else
{
e.Effect = DragDropEffects.None;
}
}

    private void txtAppPath_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
    {
        txtLocalFileName.Text = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
    }
QQ截图20181224145131.png QQ截图20181224145237.png

相关文章

网友评论

      本文标题:C# winform实现文件拖拽功能

      本文链接:https://www.haomeiwen.com/subject/ugozkqtx.html