C# textbox拖入路径

2021-01-28 12:16

阅读:488

标签:enter   one   vat   oid   link   路径   form   file   lse   

private void txt_file_DragDrop(object sender, DragEventArgs e)
{
((TextBox)sender).Text = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();

string strFileName = this.txt_file.Text.Trim();
if (strFileName == "") return;

if (strFileName.Substring(strFileName.Length - 4, 4) != ".csv"
&& strFileName.Substring(strFileName.Length - 4, 4) != ".CSV")
{
this.txt_file.Text = strFileName + ".csv";
}
}

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

C# textbox拖入路径

标签:enter   one   vat   oid   link   路径   form   file   lse   

原文地址:https://www.cnblogs.com/-jwj/p/11891363.html


评论


亲,登录后才可以留言!