升级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
+4 -23
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)