升级1.7.5,Slider新增背景条颜色,Spin参数修改,UploadDragger事件参数修改,Table支持树节点删除

This commit is contained in:
czz_y 2024-11-21 00:01:27 +08:00
parent aad4757c5e
commit d7936ea813
6 changed files with 91 additions and 29 deletions

View File

@ -13,7 +13,7 @@
<Copyright>Copyright © 2024 czz_y</Copyright>
<FileVersion>$(Version)</FileVersion>
<AssemblyVersion>$(Version)</AssemblyVersion>
<Version>1.7.4</Version>
<Version>1.7.5</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.4" />
<PackageReference Include="AntdUI" Version="1.7.5" />
<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.4`
本项目基于 `Winform .NET Framework 4.8` 开发,是 [AntdUI](https://gitee.com/antdui/AntdUI) 的 Demo 项目,当前版本 `1.7.5`
</div>

View File

@ -266,6 +266,7 @@
this.slider2.Size = new System.Drawing.Size(200, 32);
this.slider2.TabIndex = 1;
this.slider2.Text = "slider2";
this.slider2.TrackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(169)))), ((int)(((byte)(244)))));
this.slider2.Value = 50;
//
// slider1

View File

@ -1,4 +1,5 @@
using System;
using AntdUI;
using System;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
@ -27,15 +28,20 @@ namespace AntdUIDemo.Views
private void Button_control_Click(object sender, EventArgs e)
{
AntdUI.Spin.open(label_spin, new AntdUI.Spin.Config()
AntdUI.Spin.open(label_spin, new Spin.Config()
{
Back = Color.FromArgb(220, 147, 181, 207),
Color = Color.White,
Color = Style.Db.Primary,//转圈颜色
Radius = 6,
Font = new Font("Microsoft YaHei UI", 7f),//字体可以控制进度圈的大小
}, (config) =>
{
//耗时代码,处理数据
Thread.Sleep(3000);
}, () =>
{
//耗时代码,加载数据
Thread.Sleep(1000);
//结束时执行的代码
});
}
@ -44,12 +50,28 @@ namespace AntdUIDemo.Views
AntdUI.Spin.open(window, new AntdUI.Spin.Config()
{
Back = Color.FromArgb(220, 147, 181, 207),
Color = Color.White,
Color = Style.Db.Primary,//转圈颜色
Radius = 6,
Fore = Color.Black,//字体颜色
Font = new Font("Microsoft YaHei UI", 14f),//字体可以控制进度圈的大小
}, (config) =>
{
//耗时代码,处理数据
config.Text = "正在处理中,当前进度0%...";
Thread.Sleep(1000);
//value范围:0-1
config.Value = 0.2f;
config.Text = "正在处理中,当前进度20%...";
Thread.Sleep(1000);
config.Value = 0.5f;
config.Text = "正在处理中,当前进度50%...";
Thread.Sleep(1000);
config.Value = 1.0f;
config.Text = "处理完成!";
Thread.Sleep(1000);
}, () =>
{
//耗时代码,加载数据
Thread.Sleep(1000);
//结束时执行的代码
});
}
@ -58,27 +80,46 @@ namespace AntdUIDemo.Views
AntdUI.Spin.open(this, new AntdUI.Spin.Config()
{
Back = Color.FromArgb(220, 147, 181, 207),
Color = Color.White,
Color = Style.Db.Primary,//转圈颜色
Radius = 6,
Fore = Color.Black,//字体颜色
Font = new Font("Microsoft YaHei UI", 14f),//字体可以控制进度圈的大小
}, (config) =>
{
//耗时代码,处理数据
config.Text = "正在处理中,当前进度0%...";
Thread.Sleep(1000);
//value范围:0-1
config.Value = 0.2f;
config.Text = "正在处理中,当前进度20%...";
Thread.Sleep(1000);
config.Value = 0.5f;
config.Text = "正在处理中,当前进度50%...";
Thread.Sleep(1000);
config.Value = 1.0f;
config.Text = "处理完成!";
Thread.Sleep(1000);
}, () =>
{
//耗时代码,加载数据
Thread.Sleep(1000);
//结束时执行的代码
});
}
private void Button_base_Click(object sender, EventArgs e)
{
//匿名委托
AntdUI.Spin.open(flowPanel1, new AntdUI.Spin.Config()
{
Back = Color.FromArgb(220, 147, 181, 207),
Color = Color.White,
Color = Style.Db.Primary,//转圈颜色
Radius = 6,
Font = new Font("Microsoft YaHei UI", 7f),//字体可以控制进度圈的大小
}, (config) =>
{
//耗时代码,处理数据
Thread.Sleep(3000);
}, () =>
{
//耗时代码,加载数据
Thread.Sleep(1000);
//结束时执行的代码
});
}
}

View File

@ -152,6 +152,7 @@ namespace AntdUIDemo.Views
//判断是否右键
if (e.Button == MouseButtons.Right)
{
if (antList.Count == 0) return;
AntdUI.ContextMenuStrip.open(new AntdUI.ContextMenuStrip.Config(table_base,
(item) =>
{
@ -183,21 +184,42 @@ namespace AntdUIDemo.Views
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
if (antList.Any(antitem => antitem.Selected = true))
//父元素没有勾选或者子元素也没有勾选,则删除当前行
bool delCurrent = !antList.Any(x => x.Selected || (x.Users?.Any(u => u.Selected) ?? false));
if (delCurrent)
{
//使用反转for循环删除
for (int i = antList.Count - 1; i >= 0; i--)
//删除当前行,先判断是否父元素,再判断是否子元素,只支持一层子元素,需实现嵌套查询
for (int i = 0; i < antList.Count; i++)
{
if (antList[i].Selected)
if (antList[i] == user)
{
antList.Remove(antList[i]);
antList.RemoveAt(i);
}
else
{
antList[i].Users = antList[i].Users?.Where(x => x != user).ToArray();
}
}
}
else
{
antList.Remove(user);
// 使用反转for循环删除主列表中选中的项
for (int i = antList.Count - 1; i >= 0; i--)
{
// 1.删除选中的主列表项
if (antList[i].Selected)
{
antList.RemoveAt(i);
}
else
{
// 删除子列表中选中的项
antList[i].Users = antList[i].Users?.Where(childUser => !childUser.Selected).ToArray();
}
}
}
}
}
else
@ -273,7 +295,7 @@ namespace AntdUIDemo.Views
// 判断子元素是否勾选
for (int i = 0; i < antList.Count; i++)
{
if (antList[i].Users !=null && antList[i].Users.Any(x => x.Selected))
if (antList[i].Users != null && antList[i].Users.Any(x => x.Selected))
{
isSubSelected = true;
break;
@ -303,8 +325,6 @@ namespace AntdUIDemo.Views
antList[i].Users = antList[i].Users?.Where(user => !user.Selected).ToArray();
}
}
//BUG:删除树节点数据需要重新绑定才刷新
table_base.Binding(antList);
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
@ -358,7 +378,7 @@ namespace AntdUIDemo.Views
IconRatio = 0.5f,
PrefixSvg = "<svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"search\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z\"></path></svg>"
},
CellLinks = new CellLink[] {new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI")},
CellLinks = new CellLink[] { new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI") },
//value:0-1
CellProgress = new CellProgress(1f),
CellDivider = new CellDivider(),

View File

@ -41,7 +41,7 @@ namespace AntdUIDemo.Views
}
}
private void UploadDragger_DragChanged(object sender, AntdUI.UploadDragger.StringsEventArgs e)
private void UploadDragger_DragChanged(object sender, AntdUI.StringsEventArgs e)
{
string[] filePaths = e.Value;
foreach (string path in filePaths)