antdui-demo/Views/UploadDraggerDemo.cs

35 lines
1.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Windows.Forms;
namespace AntdUIDemo.Views
{
public partial class UploadDraggerDemo : UserControl
{
private AntdUI.Window window;
public UploadDraggerDemo(AntdUI.Window _window)
{
window = _window;
InitializeComponent();
BindEventHandler();
}
private void BindEventHandler()
{
//1.7.14开始,uploadDragger自带点击打开文件选择框
uploadDragger.DragChanged += UploadDragger_DragChanged;
uploadDragger.Multiselect = true;//允许多选文件
uploadDragger.Filter = "All Files (*.*)|*.*";//文件筛选
uploadDragger.HandDragFolder = true;//是否支持拖拽默认为true
}
private void UploadDragger_DragChanged(object sender, AntdUI.StringsEventArgs e)
{
string[] filePaths = e.Value;
foreach (string path in filePaths)
{
AntdUI.Message.info(window, path, autoClose: 3);
}
}
}
}