修复FloatButton,FlowPanel,StackPanel属性改变失效问题

This commit is contained in:
czz_y 2024-09-12 17:07:19 +08:00
parent 69aee5738a
commit 9a71f4bcbe
5 changed files with 37 additions and 22 deletions

View File

@ -1,15 +0,0 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntdUIDemo.Utils
{
public class ConfigurationHelper
{
}
}

View File

@ -163,18 +163,21 @@ namespace AntdUIDemo.Views
if (InvokeRequired)
{
Invoke(new Action(CloseFloatButtonForm));
return;
}
if (floatButtonForm != null)
else
{
floatButtonForm.Close();
floatButtonForm.Dispose();
floatButtonForm = null;
// Ensure that floatButtonForm is not null before attempting to close it
if (floatButtonForm != null)
{
floatButtonForm.Close();
floatButtonForm.Dispose();
floatButtonForm = null;
}
}
}
#region EventHandler
private void select_intvalue_SelectedIndexChanged(object sender, IntEventArgs e)
{

View File

@ -75,7 +75,14 @@ namespace AntdUIDemo.Views
private void switch_autoscroll_CheckedChanged(object sender, BoolEventArgs e)
{
flowPanel.AutoScroll = switch_autoscroll.Checked;
if (flowPanel.InvokeRequired)
{
flowPanel.Invoke(new Action(() => { flowPanel.AutoScroll = switch_autoscroll.Checked; }));
}
else
{
flowPanel.AutoScroll = switch_autoscroll.Checked;
}
}
// 初始化下拉框
@ -95,6 +102,10 @@ namespace AntdUIDemo.Views
{
flowPanel.Invoke(new Action(() => { flowPanel.Align = (TAlignFlow)select_align.SelectedValue; }));
}
else
{
flowPanel.Align = (TAlignFlow)select_align.SelectedValue;
}
}
private void input_gap_ValueChanged(object sender, DecimalEventArgs e)
@ -103,6 +114,10 @@ namespace AntdUIDemo.Views
{
flowPanel.Invoke(new Action(() => { flowPanel.Gap = (int)input_gap.Value; }));
}
else
{
flowPanel.Gap = (int)input_gap.Value;
}
}
// 添加按钮
private void buttonADD_Click(object sender, EventArgs e)

View File

@ -54,6 +54,8 @@ namespace AntdUIDemo.Views
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
CloseIcon = true,
Keyboard = false,
MaskClosable = false,
});
}
@ -61,6 +63,8 @@ namespace AntdUIDemo.Views
{
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
//禁止使用键盘关闭
Keyboard = false,
MaskClosable = false,
});
}

View File

@ -89,6 +89,10 @@ namespace AntdUIDemo.Views
stackPanel.ItemSize = input_itemsize.Text;
}));
}
else
{
stackPanel.ItemSize = input_itemsize.Text;
}
}
private void input_gap_ValueChanged(object sender, DecimalEventArgs e)
@ -100,6 +104,10 @@ namespace AntdUIDemo.Views
stackPanel.Gap = (int)input_gap.Value;
}));
}
else
{
stackPanel.Gap = (int)input_gap.Value;
}
}
private void ButtonDEL_Click(object sender, EventArgs e)