升级1.7.14,UploadDragger默认支持点击打开文件对话框并配置相关属性

This commit is contained in:
czz_y 2024-12-27 09:10:27 +08:00
parent 9b9fa6411c
commit 2b0a6b532c
3 changed files with 7 additions and 26 deletions

View File

@ -13,7 +13,7 @@
<Copyright>Copyright © 2024 czz_y</Copyright>
<FileVersion>$(Version)</FileVersion>
<AssemblyVersion>$(Version)</AssemblyVersion>
<Version>1.7.13</Version>
<Version>1.7.14</Version>
<Authors>czz_y</Authors>
<Description>基于 Winform UI 框架 AntdUI 设计的 Demo</Description>
<PackageProjectUrl>https://gitee.com/mubaiyanghua/antd-uidemo</PackageProjectUrl>
@ -30,7 +30,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AntdUI" Version="1.7.13" />
<PackageReference Include="AntdUI" Version="1.7.14" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.3.3" />
</ItemGroup>

View File

@ -4,7 +4,7 @@
<h1>AntdUI Demo</h1>
本项目基于 `Winform .NET Framework 4.8` 开发,是 [AntdUI](https://gitee.com/antdui/AntdUI) 的 Demo 项目,当前版本 `1.7.13`
本项目基于 `Winform .NET Framework 4.8` 开发,是 [AntdUI](https://gitee.com/antdui/AntdUI) 的 Demo 项目,当前版本 `1.7.14`
</div>

View File

@ -15,30 +15,11 @@ namespace AntdUIDemo.Views
private void BindEventHandler()
{
//1.7.14开始,uploadDragger自带点击打开文件选择框
uploadDragger.DragChanged += UploadDragger_DragChanged;
uploadDragger.Click += UploadDragger_Click;
}
private void UploadDragger_Click(object sender, EventArgs e)
{
// 创建一个文件对话框实例
OpenFileDialog openFileDialog = new OpenFileDialog();
// 设置文件对话框的属性
openFileDialog.Filter = "All Files (*.*)|*.*"; // 过滤器,允许选择所有文件
openFileDialog.Title = "Select a File"; // 对话框标题
openFileDialog.Multiselect = false; // 不允许多选文件
// 显示文件对话框并检查用户是否选择了文件
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
// 获取用户选择的文件路径
string[] filePaths = openFileDialog.FileNames;
foreach (string path in filePaths)
{
AntdUI.Message.info(window, path, autoClose: 3);
}
}
uploadDragger.Multiselect = true;//允许多选文件
uploadDragger.Filter = "All Files (*.*)|*.*";//文件筛选
uploadDragger.HandDragFolder = true;//是否支持拖拽默认为true
}
private void UploadDragger_DragChanged(object sender, AntdUI.StringsEventArgs e)