資源簡(jiǎn)介
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
namespace?拖拽獲取文件名
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????????this.AllowDrop?=?true;
????????}
????????private?void?Form1_DragDrop(object?sender?DragEventArgs?e)
????????{
????????????if?(e.Data.GetDataPresent(DataFormats.FileDrop))
????????????????e.Effect?=?DragDropEffects.All;
????????????else
????????????????e.Effect?=?DragDropEffects.None;
????????}
????????private?void?Form1_DragEnter(object?sender?DragEventArgs?e)
????????{
????????????if?(radioButton1.Checked)
????????????{
????????????????//單文件
????????????????listBox1.Items.Clear();
????????????????string?path?=?((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
????????????????textBox1.Text?=?path;
????????????}
????????????else?if?(radioButton2.Checked)
????????????{
????????????????//多文件
????????????????textBox1.Text=““;
????????????????String[]?fileNames?=?(String[])e.Data.GetData(DataFormats.FileDrop);
????????????????int?j?=?listBox1.Items.Count?+?1;
????????????????for?(int?i?=?0;?i?????????????????{
????????????????????listBox1.Items.Add(String.Format(“{0:D3}?“?i?+?j)?+?fileNames[i]);
????????????????}
????????????}
???????????
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????MessageBox.Show(“VBA/VSTO/.NET交流分享群【675166879】“?“Savetime友情提示“?MessageBoxButtons.OK);
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-10-25?04:55??.vs\
?????目錄???????????0??2020-10-25?04:55??.vs\拖拽獲取文件名\
?????目錄???????????0??2020-10-25?04:55??.vs\拖拽獲取文件名\v16\
?????文件???????16896??2020-10-25?05:25??.vs\拖拽獲取文件名\v16\.suo
?????目錄???????????0??2020-10-25?04:55??bin\
?????目錄???????????0??2020-10-25?05:02??bin\Debug\
?????文件???????49664??2020-10-25?05:24??bin\Debug\拖拽獲取文件名.exe
?????文件???????34304??2020-10-25?05:24??bin\Debug\拖拽獲取文件名.pdb
?????文件????????1834??2020-10-25?05:24??Form1.cs
?????文件????????7117??2020-10-25?05:24??Form1.Designer.cs
?????文件???????63235??2020-10-25?05:24??Form1.resx
?????目錄???????????0??2020-10-25?04:55??obj\
?????目錄???????????0??2020-10-25?05:24??obj\Debug\
?????文件?????????208??2020-10-25?04:55??obj\Debug\.NETfr
?????文件?????????819??2020-10-25?04:55??obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6905??2020-10-25?04:57??obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????目錄???????????0??2020-10-25?04:55??obj\Debug\TempPE\
?????文件??????????42??2020-10-25?05:02??obj\Debug\拖拽獲取文件名.csproj.CoreCompileInputs.cache
?????文件?????????973??2020-10-25?05:02??obj\Debug\拖拽獲取文件名.csproj.FileListAbsolute.txt
?????文件????????1012??2020-10-25?05:24??obj\Debug\拖拽獲取文件名.csproj.GenerateResource.cache
?????文件?????????424??2020-10-25?05:11??obj\Debug\拖拽獲取文件名.csprojAssemblyReference.cache
?????文件???????49664??2020-10-25?05:24??obj\Debug\拖拽獲取文件名.exe
?????文件???????38644??2020-10-25?05:24??obj\Debug\拖拽獲取文件名.Form1.resources
?????文件???????34304??2020-10-25?05:24??obj\Debug\拖拽獲取文件名.pdb
?????文件?????????180??2020-10-25?05:02??obj\Debug\拖拽獲取文件名.Properties.Resources.resources
?????文件?????????502??2020-10-25?04:55??Program.cs
?????目錄???????????0??2020-10-25?04:55??Properties\
?????文件????????1334??2020-10-25?04:55??Properties\AssemblyInfo.cs
?????文件????????2855??2020-10-25?04:55??Properties\Resources.Designer.cs
?????文件????????5612??2020-10-25?04:55??Properties\Resources.resx
?????文件????????1108??2020-10-25?04:55??Properties\Settings.Designer.cs
............此處省略3個(gè)文件信息
評(píng)論
共有 條評(píng)論