diff --git a/.gitignore b/.gitignore
index 009764e398acd85e7ca93ca7afd912c40edb1a2f..f7aa2a84b2d9deb9df1fd85fcfada3ed8404e3be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,21 @@
-.vs/
-obj/
\ No newline at end of file
+# Build and Release Folders
+bin-debug/
+bin-release/
+[Oo]bj/
+[Bb]in/
+
+# Other files and folders
+*.csproj.user
+
+# Executables
+*.swf
+*.air
+*.ipa
+*.apk
+*.vcxproj.filters
+*.vcxproj.user
+*.pubxml.user
+
+# Projects
+/.vs
+/packages
\ No newline at end of file
diff --git a/AntdUI_HamburgerMenuTabs.csproj b/AntdUI_HamburgerMenuTabs.csproj
index c50e8bf669a7a55b8947bdf6b218b0fa4e1a965a..9d9000ef1294fdc769cd1b52b8886b1c15dba19b 100644
--- a/AntdUI_HamburgerMenuTabs.csproj
+++ b/AntdUI_HamburgerMenuTabs.csproj
@@ -2,17 +2,23 @@
WinExe
- net9.0-windows7.0
+ net9.0-windows
enable
true
enable
+ true
-
+
+
+ True
+ True
+ Resources.resx
+
True
True
@@ -20,6 +26,13 @@
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
SettingsSingleFileGenerator
diff --git a/AntdUI_HamburgerMenuTabs.csproj.user b/AntdUI_HamburgerMenuTabs.csproj.user
deleted file mode 100644
index 7c6cb4333a589264fd090e9d6c85604f8e282386..0000000000000000000000000000000000000000
--- a/AntdUI_HamburgerMenuTabs.csproj.user
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
- Form
-
-
- Form
-
-
- UserControl
-
-
- UserControl
-
-
- UserControl
-
-
-
\ No newline at end of file
diff --git a/Common/App.cs b/Common/App.cs
new file mode 100644
index 0000000000000000000000000000000000000000..1785fb337e5ab4689daa05789a3adbcd8b248b24
--- /dev/null
+++ b/Common/App.cs
@@ -0,0 +1,9 @@
+namespace AntdUI_HamburgerMenuTabs.Common
+{
+ internal class App
+ {
+ public const string AppName = "AntdUI 汉堡包菜单 + 多标签页面";
+ public const string AppAuthor = "紫剑一品箫";
+ public const string AppVersion = "2025.04.23.01";
+ }
+}
\ No newline at end of file
diff --git a/Common/Common.cs b/Common/Common.cs
new file mode 100644
index 0000000000000000000000000000000000000000..f3b37ea1b639b8d42ad3c09908b3cb4c7c0d9cbf
--- /dev/null
+++ b/Common/Common.cs
@@ -0,0 +1,35 @@
+namespace AntdUI_HamburgerMenuTabs.Common
+{
+ internal class Common
+ {
+ public static long SizeFormat(long size, out string unit)
+ {
+ long s = 1024;
+ if (size >= s && size < s * s)
+ {
+ unit = "KB";
+ return size / s;
+ }
+ else if (size >= s * s && size < s * s * s)
+ {
+ unit = "MB";
+ return size / s / s;
+ }
+ else if (size >= s * s * s && size < s * s * s * s)
+ {
+ unit = "GB";
+ return size / s / s / s;
+ }
+ else if (size >= s * s * s * s)
+ {
+ unit = "TB";
+ return size / s / s / s / s;
+ }
+ else
+ {
+ unit = "B";
+ return size;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Common/LogUtils.cs b/Common/LogUtils.cs
new file mode 100644
index 0000000000000000000000000000000000000000..bc3e3985e7cd4a52fe66975f97d5dbe2aa92dfca
--- /dev/null
+++ b/Common/LogUtils.cs
@@ -0,0 +1,12 @@
+using System.Diagnostics;
+
+namespace AntdUI_HamburgerMenuTabs.Common
+{
+ internal class LogUtils
+ {
+ public static void VsPrint(string log)
+ {
+ Debug.Print($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] {log}");
+ }
+ }
+}
\ No newline at end of file
diff --git a/Forms/FullScreen.Designer.cs b/Forms/FullScreen.Designer.cs
index a15f12dfb6594c6a304368dc2d915d3456e97186..4728c4e467080631175141da2b5b453cc8e56ba0 100644
--- a/Forms/FullScreen.Designer.cs
+++ b/Forms/FullScreen.Designer.cs
@@ -29,7 +29,6 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "FullScreen";
}
diff --git a/FrmMain.Designer.cs b/FrmMain.Designer.cs
index 226f56f769eff8f812e59fe69b8f28a4abb4afa4..f8990f0540db2be3ce1258eb4cf917edb33af85d 100644
--- a/FrmMain.Designer.cs
+++ b/FrmMain.Designer.cs
@@ -28,24 +28,40 @@
///
private void InitializeComponent()
{
- windowBar1 = new AntdUI.WindowBar();
+ winBar = new AntdUI.PageHeader();
+ colorTheme = new AntdUI.ColorPicker();
btnTheme = new AntdUI.Button();
btnFullScreen = new AntdUI.Button();
panelMain = new AntdUI.Panel();
tipB = new AntdUI.TooltipComponent();
- windowBar1.SuspendLayout();
+ winBar.SuspendLayout();
SuspendLayout();
//
- // windowBar1
+ // winBar
//
- windowBar1.Controls.Add(btnTheme);
- windowBar1.Controls.Add(btnFullScreen);
- windowBar1.Dock = DockStyle.Top;
- windowBar1.Location = new Point(0, 0);
- windowBar1.Name = "windowBar1";
- windowBar1.Size = new Size(800, 40);
- windowBar1.TabIndex = 0;
- windowBar1.Text = "windowBar1";
+ winBar.Controls.Add(colorTheme);
+ winBar.Controls.Add(btnTheme);
+ winBar.Controls.Add(btnFullScreen);
+ winBar.Dock = DockStyle.Top;
+ winBar.Location = new Point(0, 0);
+ winBar.Name = "winBar";
+ winBar.ShowButton = true;
+ winBar.ShowIcon = true;
+ winBar.Size = new Size(800, 40);
+ winBar.TabIndex = 0;
+ //
+ // colorTheme
+ //
+ colorTheme.Dock = DockStyle.Right;
+ colorTheme.Location = new Point(488, 0);
+ colorTheme.Name = "colorTheme";
+ colorTheme.Padding = new Padding(8);
+ colorTheme.Round = true;
+ colorTheme.ShowClose = true;
+ colorTheme.Size = new Size(40, 40);
+ colorTheme.TabIndex = 5;
+ colorTheme.Value = Color.FromArgb(22, 119, 255);
+ colorTheme.WaveSize = 0;
//
// btnTheme
//
@@ -72,9 +88,9 @@
panelMain.Dock = DockStyle.Fill;
panelMain.Location = new Point(0, 40);
panelMain.Name = "panelMain";
+ panelMain.Radius = 0;
panelMain.Size = new Size(800, 410);
panelMain.TabIndex = 1;
- panelMain.Text = "panel1";
//
// tipB
//
@@ -84,24 +100,23 @@
//
// FrmMain
//
- AutoScaleDimensions = new SizeF(7F, 17F);
- AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panelMain);
- Controls.Add(windowBar1);
+ Controls.Add(winBar);
Font = new Font("微软雅黑", 9F);
Name = "FrmMain";
Text = "Form1";
- windowBar1.ResumeLayout(false);
+ winBar.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
- private AntdUI.WindowBar windowBar1;
+ private AntdUI.PageHeader winBar;
private AntdUI.Panel panelMain;
private AntdUI.Button btnFullScreen;
private AntdUI.TooltipComponent tipB;
private AntdUI.Button btnTheme;
+ private AntdUI.ColorPicker colorTheme;
}
}
diff --git a/FrmMain.cs b/FrmMain.cs
index 95774a268cdea55c3613e10181bcc2cc0f57f2d5..813c00b11fa209690fccfb02280ea142f785bc60 100644
--- a/FrmMain.cs
+++ b/FrmMain.cs
@@ -10,14 +10,14 @@ namespace AntdUI_HamburgerMenuTabs
{
InitializeComponent();
+ Text = Common.App.AppName;
Size = new(1024, 576);
StartPosition = FormStartPosition.CenterScreen;
- //TopMost = true;
- Helpers.Antd.SetTheme(this, btnTheme);
+ Helpers.Antd.ReadTheme(this, btnTheme, colorTheme);
- windowBar1.Text = $"˵ + ǩҳ";
- windowBar1.SubText = "ʾ";
+ winBar.Text = Common.App.AppName;
+ winBar.SubText = $"{Common.App.AppAuthor} | V{Common.App.AppVersion}";
tipB.SetTip(btnFullScreen, "ȫʾ (F11)");
btnFullScreen.Click += (s, e) =>
@@ -28,46 +28,18 @@ namespace AntdUI_HamburgerMenuTabs
tipB.SetTip(btnTheme, "л");
btnTheme.Click += (s, e) =>
{
- Helpers.Antd.SetTheme(this, btnTheme, !AntdUI.Config.IsDark, Properties.Settings.Default.ThemeColor);
+ Helpers.Antd.SwitchTheme(this, btnTheme);
};
+ colorTheme.ValueChanged += (s, e) =>
+ {
+ Helpers.Antd.SetThemeColorAndSave(this, colorTheme.Value);
+ };
+ tipB.SetTip(colorTheme, "ɫ");
+
hmt.Dock = DockStyle.Fill;
panelMain.Controls.Add(hmt);
InitHamburgerMenuTabs();
-
- #region Panel ɫ
- // Panel ɫΪ Transparent ʱڳߴʱdzĬϱɫΪ Control ʱû⣬ܳ
- AntdUI.Button btnPanelBackColorSwitch = new()
- {
- Text = $"л Panel ɫǰ BackColor = Control - {panelMain.BackColor}",
- AutoSize = true,
- AutoSizeMode = AntdUI.TAutoSize.Width,
- Dock = DockStyle.Right,
- Type = AntdUI.TTypeMini.Primary,
- IconSvg = "BugFilled",
- };
- btnPanelBackColorSwitch.Click += (s, e) =>
- {
- if (panelMain.BackColor == Color.Transparent)
- {
- panelMain.BackColor = default;
- btnPanelBackColorSwitch.Text = $"л Panel ɫǰ BackColor = Control - {panelMain.BackColor}";
- }
- else
- {
- panelMain.BackColor = Color.Transparent;
- btnPanelBackColorSwitch.Text = "л Panel ɫǰ BackColor = Transparent";
- }
- AntdUI.Message.open(new AntdUI.Message.Config(this, $"Panel ɫ{panelMain.BackColor}", AntdUI.TType.Warn)
- {
- Font = new(Font.FontFamily, 15),
- Align = AntdUI.TAlignFrom.Bottom,
- Padding = new(15, 15),
- });
- };
- windowBar1.Controls.Add(btnPanelBackColorSwitch);
- btnPanelBackColorSwitch.BringToFront();
- #endregion
}
///
@@ -93,11 +65,45 @@ namespace AntdUI_HamburgerMenuTabs
private void InitHamburgerMenuTabs()
{
List menus = [
- new MyMenuItem("home", "ҳ", "HomeFilled")
+ new MyMenuItem("Home", "ҳ", "HomeFilled")
{
PageType = typeof(Pages.Home),
Closeable = false,
},
+ new MyMenuItem("Tools", "", "ToolFilled")
+ {
+ Sub = [
+ new MyMenuItem("ToolsPerformanceMonitor", "ܼ", null)
+ {
+ PageType = typeof(Pages.Tools.PerformanceMonitor),
+ },
+ new MyMenuItem("ToolsRandomCode", "", null)
+ {
+ PageType = typeof(Pages.Tools.RandomCode),
+ },
+ ],
+ },
+ new MyMenuItem("Demo", "ʾ", "GithubFilled")
+ {
+ Sub = [
+ new MyMenuItem("DemoGridPanel", "GridPanel դ", null)
+ {
+ PageType = typeof(Pages.Demo.GridPanel),
+ },
+ new MyMenuItem("DemoTable", "Table ", null)
+ {
+ PageType = typeof(Pages.Demo.Table),
+ },
+ new MyMenuItem("DemoTour", "Tour ", null)
+ {
+ PageType = typeof(Pages.Demo.Tour),
+ },
+ new MyMenuItem("DemoTree", "Tree οؼ", null)
+ {
+ PageType = typeof(Pages.Demo.Tree),
+ },
+ ],
+ },
new MyMenuItem("menu.1", "˵ 1", "ProductFilled")
{
PageType = typeof(Pages.TestWithArgs),
diff --git a/Helpers/Antd.cs b/Helpers/Antd.cs
index a60b1e170421e51d28e7014520559a1f9515d2d0..478f9d27020680b07fb23d0f4d5bdb1a32a21fed 100644
--- a/Helpers/Antd.cs
+++ b/Helpers/Antd.cs
@@ -1,71 +1,93 @@
namespace AntdUI_HamburgerMenuTabs.Helpers
{
+ ///
+ /// AntdUI 帮助类
+ /// 版本:2025.04.21.01
+ ///
public class Antd
{
readonly static HashSet subWindows = [];
///
- /// 设置主题
+ /// 设置主题(读取用户配置)
///
///
///
- public static void SetTheme(AntdUI.Window window, AntdUI.Button? btnSwitch)
+ public static void ReadTheme(AntdUI.Window window, AntdUI.Button? btnSwitch, AntdUI.ColorPicker? colorTheme)
{
bool dark = Properties.Settings.Default.ThemeDark;
+ SetTheme(window, btnSwitch, dark);
Color primary = Properties.Settings.Default.ThemeColor;
- AntdUI.Config.IsDark = dark;
- if (dark)
- {
- if (btnSwitch != null) btnSwitch.IconSvg = "MoonFilled";
- window.BackColor = Color.Black;
- window.ForeColor = Color.White;
- }
- else
- {
- if (btnSwitch != null) btnSwitch.IconSvg = "SunOutlined";
- window.BackColor = Color.White;
- window.ForeColor = Color.Black;
- }
AntdUI.Style.SetPrimary(primary);
+ if (colorTheme != null) colorTheme.Value = primary;
+ window.Refresh();
+ }
+
+ ///
+ /// 设置主题和主题色,并保存用户配置
+ ///
+ ///
+ public static void SetThemeAndSave(AntdUI.Window window, AntdUI.Button? btnSwitch, bool dark, Color primary)
+ {
+ SetTheme(window, btnSwitch, dark);
+ AntdUI.Style.SetPrimary(primary);
+ window.Refresh();
+ BroadcastThemeToSubWindows();
+ Properties.Settings.Default.ThemeDark = dark;
+ Properties.Settings.Default.ThemeColor = primary;
+ Properties.Settings.Default.Save();
}
///
/// 设置主题
///
+ ///
+ ///
///
- public static void SetTheme(AntdUI.Window window, AntdUI.Button? btnSwitch, bool dark, Color primary)
+ public static void SetTheme(AntdUI.Window window, AntdUI.Button? btnSwitch, bool dark)
{
AntdUI.Config.IsDark = dark;
if (dark)
{
if (btnSwitch != null) btnSwitch.IconSvg = "MoonFilled";
- window.BackColor = Color.Black;
- window.ForeColor = Color.White;
+ window.BackColor = Color.FromArgb(20, 20, 20);
+ window.ForeColor = Color.FromArgb(241, 241, 241);
}
else
{
if (btnSwitch != null) btnSwitch.IconSvg = "SunOutlined";
window.BackColor = Color.White;
- window.ForeColor = Color.Black;
+ window.ForeColor = Color.FromArgb(20, 20, 20);
}
+ }
+
+ ///
+ /// 设置主题色,并保存用户配置
+ ///
+ ///
+ public static void SetThemeColorAndSave(AntdUI.Window window, Color primary)
+ {
AntdUI.Style.SetPrimary(primary);
window.Refresh();
BroadcastThemeToSubWindows();
- Properties.Settings.Default.ThemeDark = dark;
Properties.Settings.Default.ThemeColor = primary;
Properties.Settings.Default.Save();
}
///
- /// 设置主题色
+ /// 切换明暗主题
///
- ///
- public static void SetThemeColor(AntdUI.Window window, Color primary)
+ ///
+ ///
+ public static void SwitchTheme(AntdUI.Window window, AntdUI.Button? btnSwitch)
{
+ bool dark = !AntdUI.Config.IsDark;
+ SetTheme(window, btnSwitch, dark);
+ Color primary = Properties.Settings.Default.ThemeColor;
AntdUI.Style.SetPrimary(primary);
window.Refresh();
BroadcastThemeToSubWindows();
- Properties.Settings.Default.ThemeColor = primary;
+ Properties.Settings.Default.ThemeDark = dark;
Properties.Settings.Default.Save();
}
@@ -163,7 +185,7 @@
///
/// 点击蒙层是否允许关闭
///
- public static DialogResult ShowWarn(Form parent, string msg, bool maskClosable = true)
+ public static DialogResult ShowWarn(Form parent, string msg, bool maskClosable = false)
{
Form frm = parent;
DialogResult res = AntdUI.Modal.open(new AntdUI.Modal.Config(frm, "警告", msg, AntdUI.TType.Warn)
@@ -182,7 +204,7 @@
///
/// 点击蒙层是否允许关闭
///
- public static DialogResult ShowError(Form parent, string msg, bool maskClosable = true)
+ public static DialogResult ShowError(Form parent, string msg, bool maskClosable = false)
{
Form frm = parent;
DialogResult res = AntdUI.Modal.open(new AntdUI.Modal.Config(frm, "错误", msg, AntdUI.TType.Error)
@@ -195,7 +217,7 @@
}
///
- /// 征询提示窗
+ /// 选择提示窗
///
/// 父窗体
///
@@ -203,7 +225,7 @@
public static DialogResult ShowAsk(Form parent, string msg)
{
Form frm = parent;
- DialogResult res = AntdUI.Modal.open(new AntdUI.Modal.Config(frm, "注意", msg, AntdUI.TType.Warn)
+ DialogResult res = AntdUI.Modal.open(new AntdUI.Modal.Config(frm, "提示", msg, AntdUI.TType.Warn)
{
Font = frm.Font,
MaskClosable = false,
@@ -236,6 +258,15 @@
lb = _lb;
}
+ AntdUI.PageHeader? ph = null;
+
+ if (ctl is AntdUI.PageHeader _ph)
+ {
+ ph = _ph;
+ }
+
+ if (btn == null && lb == null && ph == null) throw new Exception("控件类型不支持!");
+
Random rnd = new();
int angle = 90;
if (color1 == Color.Empty) color1 = Color.FromArgb(rnd.Next(100, 200), rnd.Next(100, 200), rnd.Next(100, 200));
@@ -249,6 +280,10 @@
{
lb.ColorExtend = $"{angle},{ColorTranslator.ToHtml(color1)},{ColorTranslator.ToHtml(color2)}";
}
+ if (ph != null)
+ {
+ ph.BackExtend = $"{angle},{ColorTranslator.ToHtml(color1)},{ColorTranslator.ToHtml(color2)}";
+ }
int i = 0;
int ii = 1;
@@ -312,6 +347,10 @@
{
lb.ColorExtend = $"{angle},{ColorTranslator.ToHtml(color3)},{ColorTranslator.ToHtml(color4)}";
}
+ else if (ph != null)
+ {
+ ph.BackExtend = $"{angle},{ColorTranslator.ToHtml(color3)},{ColorTranslator.ToHtml(color4)}";
+ }
};
timer.Start();
}
diff --git a/Pages/Demo/GridPanel.Designer.cs b/Pages/Demo/GridPanel.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d410d6e73d154e42ff61b510c15e9e495bc3c6b5
--- /dev/null
+++ b/Pages/Demo/GridPanel.Designer.cs
@@ -0,0 +1,177 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Demo
+{
+ partial class GridPanel
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ panelMain = new AntdUI.Panel();
+ panelGp = new AntdUI.Panel();
+ gridPanel1 = new AntdUI.GridPanel();
+ panelOpt = new AntdUI.Panel();
+ btnMinus = new AntdUI.Button();
+ btnAdd = new AntdUI.Button();
+ btnLoad = new AntdUI.Button();
+ btnClear = new AntdUI.Button();
+ panelMain.SuspendLayout();
+ panelGp.SuspendLayout();
+ panelOpt.SuspendLayout();
+ SuspendLayout();
+ //
+ // panelMain
+ //
+ panelMain.Controls.Add(panelGp);
+ panelMain.Controls.Add(panelOpt);
+ panelMain.Dock = DockStyle.Fill;
+ panelMain.Location = new Point(0, 0);
+ panelMain.Name = "panelMain";
+ panelMain.Radius = 0;
+ panelMain.Size = new Size(662, 435);
+ panelMain.TabIndex = 0;
+ panelMain.Text = "panel1";
+ //
+ // panelGp
+ //
+ panelGp.Controls.Add(gridPanel1);
+ panelGp.Dock = DockStyle.Fill;
+ panelGp.Location = new Point(0, 60);
+ panelGp.Name = "panelGp";
+ panelGp.Padding = new Padding(5);
+ panelGp.Shadow = 10;
+ panelGp.ShadowOpacity = 0.2F;
+ panelGp.ShadowOpacityAnimation = true;
+ panelGp.ShadowOpacityHover = 0.8F;
+ panelGp.Size = new Size(662, 375);
+ panelGp.TabIndex = 2;
+ panelGp.Text = "panel1";
+ //
+ // gridPanel1
+ //
+ gridPanel1.Dock = DockStyle.Fill;
+ gridPanel1.Location = new Point(15, 15);
+ gridPanel1.Name = "gridPanel1";
+ gridPanel1.Size = new Size(632, 345);
+ gridPanel1.TabIndex = 0;
+ gridPanel1.Text = "gridPanel1";
+ //
+ // panelOpt
+ //
+ panelOpt.Controls.Add(btnClear);
+ panelOpt.Controls.Add(btnMinus);
+ panelOpt.Controls.Add(btnAdd);
+ panelOpt.Controls.Add(btnLoad);
+ panelOpt.Dock = DockStyle.Top;
+ panelOpt.Location = new Point(0, 0);
+ panelOpt.Name = "panelOpt";
+ panelOpt.Padding = new Padding(5);
+ panelOpt.Shadow = 10;
+ panelOpt.ShadowOpacity = 0.2F;
+ panelOpt.ShadowOpacityAnimation = true;
+ panelOpt.ShadowOpacityHover = 0.8F;
+ panelOpt.Size = new Size(662, 60);
+ panelOpt.TabIndex = 1;
+ panelOpt.Text = "panel1";
+ //
+ // btnMinus
+ //
+ btnMinus.Dock = DockStyle.Left;
+ btnMinus.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ btnMinus.Ghost = true;
+ btnMinus.IconSvg = "MinusOutlined";
+ btnMinus.Location = new Point(215, 15);
+ btnMinus.Name = "btnMinus";
+ btnMinus.Size = new Size(100, 30);
+ btnMinus.TabIndex = 2;
+ btnMinus.Text = "减一个";
+ btnMinus.Type = AntdUI.TTypeMini.Primary;
+ btnMinus.WaveSize = 0;
+ //
+ // btnAdd
+ //
+ btnAdd.Dock = DockStyle.Left;
+ btnAdd.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ btnAdd.Ghost = true;
+ btnAdd.IconSvg = "PlusOutlined";
+ btnAdd.Location = new Point(115, 15);
+ btnAdd.Name = "btnAdd";
+ btnAdd.Size = new Size(100, 30);
+ btnAdd.TabIndex = 1;
+ btnAdd.Text = "加一个";
+ btnAdd.Type = AntdUI.TTypeMini.Primary;
+ btnAdd.WaveSize = 0;
+ //
+ // btnLoad
+ //
+ btnLoad.Dock = DockStyle.Left;
+ btnLoad.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ btnLoad.Ghost = true;
+ btnLoad.IconSvg = "ReloadOutlined";
+ btnLoad.Location = new Point(15, 15);
+ btnLoad.Name = "btnLoad";
+ btnLoad.Size = new Size(100, 30);
+ btnLoad.TabIndex = 0;
+ btnLoad.Text = "填满";
+ btnLoad.Type = AntdUI.TTypeMini.Primary;
+ btnLoad.WaveSize = 0;
+ //
+ // btnClear
+ //
+ btnClear.Dock = DockStyle.Left;
+ btnClear.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ btnClear.Ghost = true;
+ btnClear.IconSvg = "DeleteOutlined";
+ btnClear.Location = new Point(315, 15);
+ btnClear.Name = "btnClear";
+ btnClear.Size = new Size(100, 30);
+ btnClear.TabIndex = 3;
+ btnClear.Text = "清空";
+ btnClear.Type = AntdUI.TTypeMini.Primary;
+ btnClear.WaveSize = 0;
+ //
+ // GridPanel
+ //
+ Controls.Add(panelMain);
+ Font = new Font("微软雅黑", 9F);
+ Name = "GridPanel";
+ Size = new Size(662, 435);
+ panelMain.ResumeLayout(false);
+ panelGp.ResumeLayout(false);
+ panelOpt.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private AntdUI.Panel panelMain;
+ private AntdUI.GridPanel gridPanel1;
+ private AntdUI.Panel panelOpt;
+ private AntdUI.Button btnLoad;
+ private AntdUI.Panel panelGp;
+ private AntdUI.Button btnMinus;
+ private AntdUI.Button btnAdd;
+ private AntdUI.Button btnClear;
+ }
+}
diff --git a/Pages/Demo/GridPanel.cs b/Pages/Demo/GridPanel.cs
new file mode 100644
index 0000000000000000000000000000000000000000..7c7abe7be7f37a75ea20193621c5826381611f79
--- /dev/null
+++ b/Pages/Demo/GridPanel.cs
@@ -0,0 +1,113 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Demo
+{
+ public partial class GridPanel : UserControl
+ {
+ public GridPanel()
+ {
+ InitializeComponent();
+
+ SetSpan();
+
+ btnLoad.Click += (s, e) => DoLoad();
+ btnAdd.Click += (s, e) => DoAdd();
+ btnMinus.Click += (s, e) => DoMinus();
+ btnClear.Click += (s, e) => DoClear();
+ }
+
+ private readonly int rMax = 10, cMax = 10;
+
+ private void SetSpan()
+ {
+ string cSpan = "";
+
+ for (int c = 1; c <= cMax; c++)
+ {
+ int cPercent = 100 / cMax;
+ if (c == cMax) cPercent = 100 - (100 / cMax * (cMax - 1));
+ cSpan += $"{cPercent}% ";
+ if (c == cMax)
+ {
+ cSpan = $"{cSpan.Trim()};";
+ }
+ }
+
+ string span = string.Concat(Enumerable.Repeat(cSpan, rMax));
+
+ gridPanel1.Span = span;
+ }
+
+ private void DoLoad()
+ {
+ gridPanel1.SuspendLayout();
+
+ gridPanel1.Controls.Clear();
+
+ SetSpan();
+
+ int total = rMax * cMax;
+
+ for (int i = 1; i <= total; i++)
+ {
+ AntdUI.Button btn = new()
+ {
+ Name = $"btn{i}",
+ Text = $"{i:000}",
+ Type = AntdUI.TTypeMini.Default,
+ ToggleType = AntdUI.TTypeMini.Primary,
+ WaveSize = 0,
+ };
+ btn.Click += (s, e) => btn.Toggle = !btn.Toggle;
+ gridPanel1.Controls.Add(btn);
+ btn.BringToFront();
+ }
+
+ gridPanel1.ResumeLayout();
+
+ AntdUI.Message.success(ParentForm!, $"完成", default, 2);
+ }
+
+ private void DoAdd()
+ {
+ int total = gridPanel1.Controls.Count;
+ if (total == rMax * cMax)
+ {
+ Helpers.Antd.Msgbox.ShowWarn(ParentForm!, "GridPanel 已满!");
+ return;
+ }
+ int id = total + 1;
+ AntdUI.Button btn = new()
+ {
+ Name = $"btn{id}",
+ Text = $"{id:000}",
+ Type = AntdUI.TTypeMini.Default,
+ ToggleType = AntdUI.TTypeMini.Primary,
+ WaveSize = 0,
+ };
+ btn.Click += (s, e) => btn.Toggle = !btn.Toggle;
+ gridPanel1.SuspendLayout();
+ gridPanel1.Controls.Add(btn);
+ btn.BringToFront();
+ gridPanel1.ResumeLayout();
+ }
+
+ private void DoMinus()
+ {
+ int total = gridPanel1.Controls.Count;
+ if (total == 0)
+ {
+ Helpers.Antd.Msgbox.ShowWarn(ParentForm!, "GridPanel 是空的!");
+ return;
+ }
+ Control c = gridPanel1.Controls[0];
+ gridPanel1.Controls.Remove(c);
+ c.Dispose();
+ }
+
+ private void DoClear()
+ {
+ gridPanel1.SuspendLayout();
+ gridPanel1.Controls.Clear();
+ gridPanel1.ResumeLayout();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Pages/Demo/GridPanel.resx b/Pages/Demo/GridPanel.resx
new file mode 100644
index 0000000000000000000000000000000000000000..8b2ff64a11300290ddac7e7d9bc26e5e0a766508
--- /dev/null
+++ b/Pages/Demo/GridPanel.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Pages/Demo/Table.Designer.cs b/Pages/Demo/Table.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..789d8c1bc9d9e6b81c8dc085a40811e348d7d808
--- /dev/null
+++ b/Pages/Demo/Table.Designer.cs
@@ -0,0 +1,259 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Demo
+{
+ partial class Table
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ panelMain = new Panel();
+ gridPanel1 = new AntdUI.GridPanel();
+ splitter1 = new AntdUI.Splitter();
+ table1 = new AntdUI.Table();
+ propertyGrid1 = new PropertyGrid();
+ gridPanel2 = new AntdUI.GridPanel();
+ btnRebinding = new AntdUI.Button();
+ gridPanelDataSource = new AntdUI.GridPanel();
+ radioDs2 = new AntdUI.Radio();
+ radioDs1 = new AntdUI.Radio();
+ lbDs = new AntdUI.Label();
+ inputSearch = new AntdUI.Input();
+ btnMinus = new AntdUI.Button();
+ btnAdd = new AntdUI.Button();
+ btnGetData = new AntdUI.Button();
+ panelMain.SuspendLayout();
+ gridPanel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)splitter1).BeginInit();
+ splitter1.Panel1.SuspendLayout();
+ splitter1.Panel2.SuspendLayout();
+ splitter1.SuspendLayout();
+ gridPanel2.SuspendLayout();
+ gridPanelDataSource.SuspendLayout();
+ SuspendLayout();
+ //
+ // panelMain
+ //
+ panelMain.Controls.Add(gridPanel1);
+ panelMain.Dock = DockStyle.Fill;
+ panelMain.Location = new Point(0, 0);
+ panelMain.Name = "panelMain";
+ panelMain.Padding = new Padding(5);
+ panelMain.Size = new Size(847, 489);
+ panelMain.TabIndex = 0;
+ //
+ // gridPanel1
+ //
+ gridPanel1.Controls.Add(splitter1);
+ gridPanel1.Controls.Add(gridPanel2);
+ gridPanel1.Dock = DockStyle.Fill;
+ gridPanel1.Location = new Point(5, 5);
+ gridPanel1.Name = "gridPanel1";
+ gridPanel1.Size = new Size(837, 479);
+ gridPanel1.Span = "100%;100%;-50 100%";
+ gridPanel1.TabIndex = 0;
+ gridPanel1.Text = "gridPanel1";
+ //
+ // splitter1
+ //
+ splitter1.Dock = DockStyle.Fill;
+ splitter1.FixedPanel = FixedPanel.Panel2;
+ splitter1.Location = new Point(3, 53);
+ splitter1.Name = "splitter1";
+ //
+ // splitter1.Panel1
+ //
+ splitter1.Panel1.Controls.Add(table1);
+ splitter1.Panel1.Padding = new Padding(5);
+ splitter1.Panel1.RightToLeft = RightToLeft.No;
+ //
+ // splitter1.Panel2
+ //
+ splitter1.Panel2.Controls.Add(propertyGrid1);
+ splitter1.Panel2.Padding = new Padding(5);
+ splitter1.Panel2.RightToLeft = RightToLeft.No;
+ splitter1.Panel2MinSize = 350;
+ splitter1.Size = new Size(831, 423);
+ splitter1.SplitterDistance = 462;
+ splitter1.TabIndex = 1;
+ //
+ // table1
+ //
+ table1.Dock = DockStyle.Fill;
+ table1.Location = new Point(5, 5);
+ table1.Name = "table1";
+ table1.Size = new Size(452, 413);
+ table1.TabIndex = 0;
+ table1.Text = "table1";
+ //
+ // propertyGrid1
+ //
+ propertyGrid1.BackColor = SystemColors.Control;
+ propertyGrid1.Dock = DockStyle.Fill;
+ propertyGrid1.Location = new Point(5, 5);
+ propertyGrid1.Name = "propertyGrid1";
+ propertyGrid1.PropertySort = PropertySort.Alphabetical;
+ propertyGrid1.SelectedObject = table1;
+ propertyGrid1.Size = new Size(355, 413);
+ propertyGrid1.TabIndex = 0;
+ //
+ // gridPanel2
+ //
+ gridPanel2.Controls.Add(btnRebinding);
+ gridPanel2.Controls.Add(gridPanelDataSource);
+ gridPanel2.Controls.Add(lbDs);
+ gridPanel2.Controls.Add(inputSearch);
+ gridPanel2.Controls.Add(btnMinus);
+ gridPanel2.Controls.Add(btnAdd);
+ gridPanel2.Controls.Add(btnGetData);
+ gridPanel2.Location = new Point(3, 3);
+ gridPanel2.Name = "gridPanel2";
+ gridPanel2.Size = new Size(831, 44);
+ gridPanel2.Span = "45 45 45 200 60 230 100 100%";
+ gridPanel2.TabIndex = 0;
+ gridPanel2.Text = "gridPanel2";
+ //
+ // btnRebinding
+ //
+ btnRebinding.Location = new Point(628, 3);
+ btnRebinding.Name = "btnRebinding";
+ btnRebinding.Size = new Size(94, 38);
+ btnRebinding.TabIndex = 6;
+ btnRebinding.Text = "重绑数据源";
+ btnRebinding.Type = AntdUI.TTypeMini.Primary;
+ //
+ // gridPanelDataSource
+ //
+ gridPanelDataSource.Controls.Add(radioDs2);
+ gridPanelDataSource.Controls.Add(radioDs1);
+ gridPanelDataSource.Location = new Point(398, 3);
+ gridPanelDataSource.Name = "gridPanelDataSource";
+ gridPanelDataSource.Size = new Size(224, 38);
+ gridPanelDataSource.Span = "50% 50%";
+ gridPanelDataSource.TabIndex = 5;
+ gridPanelDataSource.Text = "gridPanel3";
+ //
+ // radioDs2
+ //
+ radioDs2.Checked = true;
+ radioDs2.Location = new Point(115, 3);
+ radioDs2.Name = "radioDs2";
+ radioDs2.Size = new Size(106, 32);
+ radioDs2.TabIndex = 1;
+ radioDs2.Text = "BingdingList";
+ //
+ // radioDs1
+ //
+ radioDs1.Location = new Point(3, 3);
+ radioDs1.Name = "radioDs1";
+ radioDs1.Size = new Size(106, 32);
+ radioDs1.TabIndex = 0;
+ radioDs1.Text = "DataTable";
+ //
+ // lbDs
+ //
+ lbDs.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ lbDs.Location = new Point(338, 3);
+ lbDs.Name = "lbDs";
+ lbDs.Size = new Size(54, 38);
+ lbDs.TabIndex = 4;
+ lbDs.Text = "数据源:";
+ lbDs.TextAlign = ContentAlignment.MiddleRight;
+ //
+ // inputSearch
+ //
+ inputSearch.AllowClear = true;
+ inputSearch.IconRatio = 1F;
+ inputSearch.Location = new Point(138, 3);
+ inputSearch.Name = "inputSearch";
+ inputSearch.PlaceholderText = "查找...";
+ inputSearch.PrefixSvg = "SearchOutlined";
+ inputSearch.Size = new Size(194, 38);
+ inputSearch.TabIndex = 2;
+ //
+ // btnMinus
+ //
+ btnMinus.IconSvg = "MinusOutlined";
+ btnMinus.Location = new Point(93, 3);
+ btnMinus.Name = "btnMinus";
+ btnMinus.Size = new Size(39, 38);
+ btnMinus.TabIndex = 3;
+ btnMinus.Type = AntdUI.TTypeMini.Primary;
+ //
+ // btnAdd
+ //
+ btnAdd.IconSvg = "PlusOutlined";
+ btnAdd.Location = new Point(48, 3);
+ btnAdd.Name = "btnAdd";
+ btnAdd.Size = new Size(39, 38);
+ btnAdd.TabIndex = 1;
+ btnAdd.Type = AntdUI.TTypeMini.Primary;
+ //
+ // btnGetData
+ //
+ btnGetData.IconSvg = "RedoOutlined";
+ btnGetData.Location = new Point(3, 3);
+ btnGetData.Name = "btnGetData";
+ btnGetData.Size = new Size(39, 38);
+ btnGetData.TabIndex = 0;
+ btnGetData.Type = AntdUI.TTypeMini.Primary;
+ //
+ // Table
+ //
+ AutoScaleDimensions = new SizeF(7F, 17F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(panelMain);
+ Font = new Font("微软雅黑", 9F);
+ Name = "Table";
+ Size = new Size(847, 489);
+ panelMain.ResumeLayout(false);
+ gridPanel1.ResumeLayout(false);
+ splitter1.Panel1.ResumeLayout(false);
+ splitter1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)splitter1).EndInit();
+ splitter1.ResumeLayout(false);
+ gridPanel2.ResumeLayout(false);
+ gridPanelDataSource.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panelMain;
+ private AntdUI.GridPanel gridPanel1;
+ private AntdUI.Splitter splitter1;
+ private AntdUI.Table table1;
+ private PropertyGrid propertyGrid1;
+ private AntdUI.GridPanel gridPanel2;
+ private AntdUI.Button btnGetData;
+ private AntdUI.Button btnAdd;
+ private AntdUI.Input inputSearch;
+ private AntdUI.Button btnMinus;
+ private AntdUI.Label lbDs;
+ private AntdUI.GridPanel gridPanelDataSource;
+ private AntdUI.Radio radioDs2;
+ private AntdUI.Radio radioDs1;
+ private AntdUI.Button btnRebinding;
+ }
+}
diff --git a/Pages/Demo/Table.cs b/Pages/Demo/Table.cs
new file mode 100644
index 0000000000000000000000000000000000000000..c4ae7377854ab3b26d09aac0a46c2784a2410b59
--- /dev/null
+++ b/Pages/Demo/Table.cs
@@ -0,0 +1,783 @@
+using System.ComponentModel;
+using System.Data;
+
+namespace AntdUI_HamburgerMenuTabs.Pages.Demo
+{
+ public partial class Table : UserControl
+ {
+ private readonly BindingList data = [];
+ private bool isTableEventsInited = false;
+
+ public Table()
+ {
+ InitializeComponent();
+
+ btnGetData.Click += (s, e) => GetData();
+
+ btnAdd.Click += (s, e) => AddRow();
+
+ btnMinus.Click += (s, e) => DeleteRows();
+
+ inputSearch.TextChanged += (s, e) => Search();
+
+ btnRebinding.Click += (s, e) => Rebinding();
+ }
+
+ private class DataModel : AntdUI.NotifyProperty
+ {
+ public DataModel(int id, string? name, int age, string? notes)
+ {
+ Id = id;
+
+ Random rnd = new();
+
+ _enable = rnd.Next(2) == 1;
+
+ if (id % 5 == 0)
+ {
+ _status = new(AntdUI.TState.Primary, "Primary");
+ }
+ else if (id % 5 == 1)
+ {
+ _status = new(AntdUI.TState.Success, "Success");
+ }
+ else if (id % 5 == 2)
+ {
+ _status = new(AntdUI.TState.Warn, "Warn");
+ }
+ else if (id % 5 == 3)
+ {
+ _status = new(AntdUI.TState.Error, "Error");
+ }
+ else if (id % 5 == 4)
+ {
+ _status = new(AntdUI.TState.Processing, "Processing");
+ }
+ else
+ {
+ _status = new(AntdUI.TState.Default, "Default");
+ }
+
+ _name = name;
+
+ _age = age;
+
+ _progress = new((float)(rnd.NextDouble()));
+
+ if (id == 1)
+ {
+ _images = [
+ new AntdUI.CellImage(Properties.Resources.CellImage) { Radius = 1 },
+ new AntdUI.CellImage(Properties.Resources.AntdUI_Button) { Radius = 1 },
+ ];
+ }
+ else
+ {
+ _images = [
+ new AntdUI.CellImage("BankFilled"),
+ new AntdUI.CellImage("GiftFilled"),
+ ];
+ }
+
+ if (rnd.Next(5) == 1)
+ {
+ _tags = [
+ new AntdUI.CellTag("Tag1", AntdUI.TTypeMini.Default),
+ new AntdUI.CellTag("Tag2", AntdUI.TTypeMini.Success),
+ ];
+ }
+
+ _notes = notes;
+
+ if (id == 1)
+ {
+ _options = [
+ new AntdUI.CellButton("edit", "编辑", AntdUI.TTypeMini.Primary),
+ new AntdUI.CellButton("delete", "删除", AntdUI.TTypeMini.Warn),
+ ];
+ }
+ else if (id == 2)
+ {
+ _options = [
+ new AntdUI.CellButton("edit", "编辑", AntdUI.TTypeMini.Primary) { Enabled = false },
+ new AntdUI.CellButton("delete", "删除", AntdUI.TTypeMini.Warn) { Enabled = false },
+ ];
+ }
+ else if (id == 3)
+ {
+ _options = [
+ new AntdUI.CellButton("edit", "编辑", AntdUI.TTypeMini.Primary) { Ghost = true },
+ new AntdUI.CellButton("delete", "删除", AntdUI.TTypeMini.Warn) { Ghost = true },
+ ];
+ }
+ else if (id == 4)
+ {
+ _options = [
+ new AntdUI.CellLink("edit", "编辑"),
+ new AntdUI.CellLink("delete", "删除"),
+ ];
+ }
+ else
+ {
+ _options = [
+ new AntdUI.CellButton("edit") { Type = AntdUI.TTypeMini.Primary, IconSvg = "EditFilled", Tooltip = "编辑" },
+ new AntdUI.CellButton("delete") { Type = AntdUI.TTypeMini.Warn, IconSvg = "DeleteFilled", Tooltip = "删除" },
+ ];
+ }
+
+ if (id == 2)
+ {
+ List subLst = [];
+ for (int i = 1; i <= 5; i++)
+ {
+ var row = new DataModel(200 + i, $"SubName-{(char)('A' + rnd.Next(0, 26))}", rnd.Next(10, 100), Guid.NewGuid().ToString())
+ {
+ Pid = 2,
+ };
+ subLst.Add(row);
+ Common.LogUtils.VsPrint($"{id} {_pid} {row.Id} {row.Pid}");
+ }
+ _sub = [.. subLst];
+ }
+ }
+
+ bool _check = false;
+ public bool Check
+ {
+ get => _check;
+ set
+ {
+ if (_check == value) return;
+ _check = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public int Id { get; set; }
+
+ int _pid;
+ public int Pid
+ {
+ get => _pid;
+ set
+ {
+ _pid = value;
+ OnPropertyChanged();
+ }
+ }
+
+ bool _check2 = false;
+ public bool Check2
+ {
+ get => _check2;
+ set
+ {
+ _check2 = value;
+ OnPropertyChanged();
+ }
+ }
+
+ bool _radio = false;
+ public bool Radio
+ {
+ get => _radio;
+ set
+ {
+ _radio = value;
+ OnPropertyChanged();
+ }
+ }
+
+ bool _enable = false;
+ public bool Enable
+ {
+ get => _enable;
+ set
+ {
+ _enable = value;
+ OnPropertyChanged();
+ }
+ }
+
+ AntdUI.CellBadge _status;
+ public AntdUI.CellBadge Status
+ {
+ get => _status;
+ set
+ {
+ _status = value;
+ OnPropertyChanged();
+ }
+ }
+
+ string? _name;
+ public string? Name
+ {
+ get => _name;
+ set
+ {
+ _name = value;
+ OnPropertyChanged();
+ }
+ }
+
+ int _age;
+ public int Age
+ {
+ get => _age;
+ set
+ {
+ _age = value;
+ OnPropertyChanged();
+ }
+ }
+
+ AntdUI.CellProgress? _progress;
+ public AntdUI.CellProgress? Progress
+ {
+ get => _progress;
+ set
+ {
+ _progress = value;
+ OnPropertyChanged();
+ }
+ }
+
+ AntdUI.CellImage[]? _images;
+ public AntdUI.CellImage[]? Images
+ {
+ get => _images;
+ set
+ {
+ _images = value;
+ OnPropertyChanged();
+ }
+ }
+
+ AntdUI.CellTag[]? _tags;
+ public AntdUI.CellTag[]? Tags
+ {
+ get => _tags;
+ set
+ {
+ _tags = value;
+ OnPropertyChanged();
+ }
+ }
+
+ string? _notes;
+ public string? Notes
+ {
+ get => _notes;
+ set
+ {
+ _notes = value;
+ OnPropertyChanged();
+ }
+ }
+
+ DateTime _addTime = DateTime.Now;
+ public DateTime AddTime
+ {
+ get => _addTime;
+ set
+ {
+ _addTime = value;
+ OnPropertyChanged();
+ }
+ }
+
+ DateTime _editTime;
+ public DateTime EditTime
+ {
+ get => _editTime;
+ set
+ {
+ _editTime = value;
+ OnPropertyChanged();
+ }
+ }
+
+ AntdUI.CellLink[]? _options;
+ public AntdUI.CellLink[]? Options
+ {
+ get => _options;
+ set
+ {
+ _options = value;
+ OnPropertyChanged();
+ }
+ }
+
+ DataModel[]? _sub;
+ public DataModel[]? Sub
+ {
+ get => _sub;
+ set
+ {
+ _sub = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private class DataSummaryModel(string id, string age)
+ {
+ public string Id { get; set; } = id;
+ public string Age { get; set; } = age;
+ }
+
+ private void InitTableDs21()
+ {
+ table1.Columns.Clear();
+
+ table1.Columns = [
+ new AntdUI.ColumnCheck("Check").SetColAlign().SetAlign().SetFixed(),
+ new AntdUI.Column("Id", "ID")
+ {
+ KeyTree = "Sub",
+ }.SetColAlign().SetAlign(AntdUI.ColumnAlign.Left).SetFixed().SetWidth("100"),
+ new AntdUI.Column("Pid", "PID").SetColAlign().SetAlign().SetFixed(),
+ new AntdUI.ColumnCheck("Check2", "多选").SetColAlign().SetAlign(),
+ new AntdUI.ColumnRadio("Radio", "单选").SetColAlign().SetAlign(),
+ new AntdUI.ColumnSwitch("Enable", "启用")
+ {
+ Call = (value, record, idRow, idCol) =>
+ {
+ Task.Delay(500).Wait();
+ Random rnd = new();
+ if (rnd.Next(2) == 1)
+ {
+ AntdUI.Message.success(ParentForm!, "成功", default, 2);
+ }
+ else
+ {
+ value = !value;
+ AntdUI.Message.error(ParentForm!, "失败", default, 2);
+ }
+ return value;
+ }
+ }.SetColAlign().SetAlign(),
+ new AntdUI.Column("Status", "状态").SetColAlign().SetAlign(),
+ new AntdUI.Column("Name", "姓名").SetColAlign().SetAlign(),
+ new AntdUI.Column("Age", "年龄").SetColAlign().SetAlign(),
+ new AntdUI.Column("Progress", "进度").SetColAlign().SetAlign(),
+ new AntdUI.Column("Images", "图片").SetColAlign().SetAlign(),
+ new AntdUI.Column("Tags", "标签").SetColAlign().SetAlign().SetWidth("auto"),
+ new AntdUI.Column("Notes", "说明").SetColAlign().SetAlign(),
+ new AntdUI.Column("AddTime", "创建时间").SetColAlign().SetAlign(),
+ new AntdUI.Column("EditTime", "编辑时间").SetColAlign().SetAlign(),
+ new AntdUI.Column("Options", "操作").SetColAlign().SetAlign().SetFixed().SetWidth("auto"),
+ ];
+ }
+
+ private void InitTableDs22()
+ {
+ table1.Binding(data);
+
+ // 注:如果启用了树形列,且任意父行存在子集,则通过 Table[RowIndex][ColumnIndex] 获取的值是不正确的,因为 RowIndex 不一致!
+
+ table1.CellClick += (s, e) =>
+ {
+ if (e.Record is DataModel record)
+ {
+ if (e.RowIndex > 0)
+ {
+ if (table1.Columns[e.ColumnIndex].Key == "Notes")
+ {
+ AntdUI.Popover.open(new AntdUI.Popover.Config(table1, $"{table1[e.RowIndex - 1]![e.ColumnIndex]}") { Offset = e.Rect, AutoClose = 1 });
+ }
+ else if (table1.Columns[e.ColumnIndex].Key == "Images")
+ {
+ if (record.Images != null)
+ {
+ if (record.Images.Length > 0)
+ {
+ List images = [];
+ foreach (var image in record.Images)
+ {
+ if (image.Image != null) images.Add(image.Image);
+ }
+ if (images.Count > 0)
+ {
+ AntdUI.Preview.open(new AntdUI.Preview.Config(ParentForm!, images)
+ {
+ Btns = [
+ new AntdUI.Preview.Btn("download", "DownloadOutlined")
+ ],
+ OnBtns = (id, data) =>
+ {
+ switch (id)
+ {
+ case "download":
+ AntdUI.Message.success(ParentForm!, "下载完毕。", default, 2);
+ break;
+ }
+ }
+ });
+ }
+ }
+ }
+ }
+ else if (table1.Columns[e.ColumnIndex].Key == "Tags")
+ {
+ if (record.Tags == null)
+ {
+ record.Tags = [
+ new AntdUI.CellTag("Tag1", AntdUI.TTypeMini.Default),
+ ];
+ }
+ else
+ {
+ if (record.Tags.Length == 1)
+ {
+ record.Tags = [
+ new AntdUI.CellTag("Tag1", AntdUI.TTypeMini.Default),
+ new AntdUI.CellTag("Tag2", AntdUI.TTypeMini.Success),
+ ];
+ }
+ else if (record.Tags.Length == 2)
+ {
+ record.Tags = [
+ new AntdUI.CellTag("Tag1", AntdUI.TTypeMini.Default),
+ new AntdUI.CellTag("Tag2", AntdUI.TTypeMini.Success),
+ new AntdUI.CellTag("Tag3", AntdUI.TTypeMini.Warn),
+ ];
+ }
+ else
+ {
+ record.Tags = [
+ new AntdUI.CellTag("Tag1", AntdUI.TTypeMini.Default),
+ ];
+ }
+ }
+ }
+ }
+ }
+ };
+
+ table1.CellDoubleClick += (s, e) =>
+ {
+ if (e.RowIndex > 0)
+ {
+ // 双击单元格复制数据
+
+ // 方法一,在树形列启用的情况下,通过 Table[RowIndex][ColumnIndex] 获取的值不正确。
+ // 子行的 e.RowIndex 是顺延父行的,而通过 Table[RowIndex][ColumnIndex] 来取单元格数据的话,
+ // 拿不到正确的行索引,子行的索引不会被计算在内,且只能取到父行的数据。
+ //string cellText = $"{table1[e.RowIndex - 1]![e.ColumnIndex]}";
+ //try
+ //{
+ // Clipboard.SetText(cellText);
+ // AntdUI.Message.success(ParentForm!, $"{cellText}\r\n已复制到剪贴板。", default, 1);
+ //}
+ //catch (Exception ex)
+ //{
+ // AntdUI.Message.error(ParentForm!, $"{ex.Message}", default, 2);
+ //}
+
+ // 方法二,在树形列启用的情况下,单元格数据复制正常,但无法准确获取待复制单元格的数据(原因同方法一)。
+ if (table1.CopyData(e.RowIndex, e.ColumnIndex))
+ {
+ AntdUI.Message.success(ParentForm!, "已复制到剪贴板。", default, 1);
+ }
+ else
+ {
+ AntdUI.Message.error(ParentForm!, "复制失败!", default, 2);
+ }
+
+ // 方法三,无法直接通过列索引取出单元格数据,只好利用反射了,在树形列启用的情况下能正常取数。
+ //if (e.Record is DataModel record)
+ //{
+ // Type type = record.GetType();
+ // PropertyInfo? pi = type.GetProperty(table1.Columns[e.ColumnIndex].Key);
+ // object? val = null;
+ // if (pi != null) val = pi.GetValue(record);
+ // string cellText = $"{val}";
+ // try
+ // {
+ // Clipboard.SetText(cellText);
+ // AntdUI.Message.success(ParentForm!, $"{cellText}\r\n已复制到剪贴板。", default, 1);
+ // }
+ // catch (Exception ex)
+ // {
+ // AntdUI.Message.error(ParentForm!, $"{ex.Message}", default, 2);
+ // }
+ //}
+ }
+ };
+
+ table1.CellButtonClick += (s, e) =>
+ {
+ if (e.Record is DataModel record)
+ {
+ if (e.Btn.Id == "edit")
+ {
+ UserControl uc = new()
+ {
+ Size = new(400, 300),
+ };
+
+ AntdUI.StackPanel stackPanel = new()
+ {
+ Dock = DockStyle.Fill,
+ Padding = new(10),
+ Vertical = true,
+ AutoScroll = true,
+ };
+ uc.Controls.Add(stackPanel);
+
+ AntdUI.GridPanel gridPanelName = new()
+ {
+ Height = 50,
+ Span = "100 100%",
+ };
+ AntdUI.Label lbName = new()
+ {
+ Text = "姓名:",
+ };
+ AntdUI.Input inputName = new()
+ {
+ Text = $"{record.Name}",
+ };
+ gridPanelName.Controls.Add(inputName);
+ gridPanelName.Controls.Add(lbName);
+ stackPanel.Controls.Add(gridPanelName);
+ gridPanelName.BringToFront();
+
+ AntdUI.GridPanel gridPanelAge = new()
+ {
+ Height = 50,
+ Span = "100 100%",
+ };
+ AntdUI.Label lbAge = new()
+ {
+ Text = "年龄:",
+ };
+ AntdUI.InputNumber inputAge = new()
+ {
+ Value = record.Age,
+ };
+ gridPanelAge.Controls.Add(inputAge);
+ gridPanelAge.Controls.Add(lbAge);
+ stackPanel.Controls.Add(gridPanelAge);
+ gridPanelAge.BringToFront();
+
+ AntdUI.GridPanel gridPanelNotes = new()
+ {
+ Height = 150,
+ Span = "100 100%",
+ };
+ AntdUI.Label lbNotes = new()
+ {
+ Text = "说明:",
+ };
+ AntdUI.Input inputNotes = new()
+ {
+ Text = $"{record.Notes}",
+ Multiline = true,
+ };
+ gridPanelNotes.Controls.Add(inputNotes);
+ gridPanelNotes.Controls.Add(lbNotes);
+ stackPanel.Controls.Add(gridPanelNotes);
+ gridPanelNotes.BringToFront();
+
+ if (AntdUI.Modal.open(new AntdUI.Modal.Config(ParentForm!, "编辑", uc, AntdUI.TType.None)
+ {
+ OkType = AntdUI.TTypeMini.Primary,
+ OkText = "保存",
+ CancelText = "取消",
+ }) == DialogResult.OK)
+ {
+ table1.Spin("删除中,请稍候...", config =>
+ {
+ Task.Delay(500).Wait();
+ record.Name = inputName.Text;
+ record.Age = (int)inputAge.Value;
+ record.Notes = inputNotes.Text;
+ record.EditTime = DateTime.Now;
+ }, () =>
+ {
+ AntdUI.Message.success(ParentForm!, "保存完毕。", default, 2);
+ });
+ }
+ }
+ else if (e.Btn.Id == "delete")
+ {
+ if (AntdUI.Modal.open(new AntdUI.Modal.Config(ParentForm!, "警告", new AntdUI.Modal.TextLine[]
+ {
+ new("是否确认删除?", 6, AntdUI.Style.Db.Warning),
+ new($"ID: {record.Id}", 6, AntdUI.Style.Db.Primary),
+ new($"Name: {record.Name}", 6, AntdUI.Style.Db.Primary),
+ }, AntdUI.TType.Warn)
+ {
+ OkType = AntdUI.TTypeMini.Warn,
+ OkText = "确认",
+ }) == DialogResult.OK)
+ {
+ table1.Spin("删除中,请稍候...", config =>
+ {
+ Task.Delay(500).Wait();
+ data.Remove(record);
+ }, () =>
+ {
+ AntdUI.Message.success(ParentForm!, "删除完毕。", default, 2);
+ });
+ }
+ }
+ }
+ };
+
+ isTableEventsInited = true;
+ }
+
+ private void GetData()
+ {
+ // 清空汇总行
+ table1.Summary = null;
+
+ gridPanel1.Spin("数据加载中...", config =>
+ {
+ Random rnd = new();
+ int rows = 0;
+
+ data.Clear();
+
+ if (radioDs1.Checked)
+ {
+ rows = rnd.Next(10, 10000);
+
+ DataTable dt = new();
+ dt.Columns.Add("Id", typeof(int));
+ dt.Columns.Add("Name", typeof(string));
+ dt.Columns.Add("Age", typeof(int));
+ dt.Columns.Add("Notes", typeof(string));
+
+ table1.DataSource = null;
+ table1.Columns.Clear();
+ table1.Columns = [
+ new AntdUI.Column("Id", "ID").SetColAlign().SetAlign(),
+ new AntdUI.Column("Name", "姓名").SetColAlign().SetAlign(),
+ new AntdUI.Column("Age", "年龄").SetColAlign().SetAlign(),
+ new AntdUI.Column("Notes", "说明").SetColAlign().SetAlign(),
+ ];
+
+ for (int i = 0; i < rows; i++)
+ {
+ dt.Rows.Add(i + 1, $"Name-{(char)('A' + rnd.Next(0, 26))}", rnd.Next(10, 100), Guid.NewGuid().ToString());
+ }
+
+ table1.DataSource = dt;
+
+ // 添加汇总行
+ table1.Summary = new DataSummaryModel($"总行数:{dt.Rows.Count}", $"平均值:{(int)dt.AsEnumerable().Average(row => row.Field("Age") ?? 0)}");
+ }
+ else if (radioDs2.Checked)
+ {
+ rows = rnd.Next(10, 100);
+
+ InitTableDs21();
+
+ if (!isTableEventsInited) InitTableDs22();
+
+ for (int i = 0; i < rows; i++)
+ {
+ config.Value = (i + 1F) / rows;
+ config.Text = $"数据加载中...[{i + 1} / {rows}]";
+ data.Add(new DataModel(i + 1, $"Name-{(char)('A' + rnd.Next(0, 26))}", rnd.Next(10, 100), Guid.NewGuid().ToString()));
+ }
+
+ // 如果启用了树形列,则需重新绑定数据源,否则子行不显示
+ table1.Binding(data);
+
+ // 添加汇总行
+ //table1.Summary = new DataModel(data.Count, "", (int)data.Average(item => item.Age), "");
+ table1.Summary = new DataSummaryModel($"总行数:{data.Count}", $"平均值:{(int)data.Average(item => item.Age)}");
+
+ // 设置行禁用
+ table1.SetRowEnable(rnd.Next(1, 10), false, true);
+ }
+
+ AntdUI.Message.info(ParentForm!, $"已加载 {rows} 行数据。", default, 2);
+ });
+ }
+
+ private void Rebinding()
+ {
+ if (radioDs2.Checked)
+ {
+ table1.Binding(data);
+ }
+ }
+
+ private void AddRow()
+ {
+ if (!radioDs2.Checked) return;
+ Random rnd = new();
+ int id = data.Max(x => x.Id);
+ data.Add(new DataModel(id + 1, $"Name-{(char)('A' + rnd.Next(0, 26))}", rnd.Next(10, 100), Guid.NewGuid().ToString()));
+ table1.Summary = new DataSummaryModel($"总行数:{data.Count}", $"平均值:{(int)data.Average(item => item.Age)}");
+ table1.ScrollLine(data.Count, true);
+ }
+
+ private void DeleteRows()
+ {
+ if (!radioDs2.Checked) return;
+
+ List ids = [];
+
+ var _data = data.Where(x => x.Check).ToList();
+
+ foreach (var record in _data)
+ {
+ ids.Add(record.Id);
+ }
+
+ if (ids.Count > 0)
+ {
+ if (AntdUI.Modal.open(new AntdUI.Modal.Config(ParentForm!, "警告", new AntdUI.Modal.TextLine[]
+ {
+ new("是否确认删除?", 6, AntdUI.Style.Db.Warning),
+ new($"IDs: {string.Join(',', ids)}", 6, AntdUI.Style.Db.Primary),
+ }, AntdUI.TType.Warn)
+ {
+ OkType = AntdUI.TTypeMini.Warn,
+ OkText = "确认",
+ }) == DialogResult.OK)
+ {
+ table1.Spin("删除中,请稍候...", config =>
+ {
+ Task.Delay(1000).Wait();
+ foreach (var record in _data)
+ {
+ data.Remove(record);
+ }
+ table1.Summary = new DataSummaryModel($"总行数:{data.Count}", $"平均值:{(int)data.Average(item => item.Age)}");
+ }, () =>
+ {
+ AntdUI.Message.success(ParentForm!, "删除完毕。", default, 2);
+ });
+ };
+ }
+ else
+ {
+ AntdUI.Message.warn(ParentForm!, "未勾选任何行!", default, 2);
+ }
+ }
+
+ private void Search()
+ {
+ string kw = inputSearch.Text.Trim();
+ if (kw == "")
+ {
+ table1.Binding(data);
+ }
+ else
+ {
+ var data1 = data.Where(x => x.Name?.Contains(kw, StringComparison.OrdinalIgnoreCase) == true || x.Notes?.Contains(kw, StringComparison.OrdinalIgnoreCase) == true).ToList();
+ var data2 = new AntdUI.AntList(data1);
+ table1.Binding(data2);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Pages/Demo/Table.resx b/Pages/Demo/Table.resx
new file mode 100644
index 0000000000000000000000000000000000000000..8b2ff64a11300290ddac7e7d9bc26e5e0a766508
--- /dev/null
+++ b/Pages/Demo/Table.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Pages/Demo/Tour.Designer.cs b/Pages/Demo/Tour.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..861eabc8a459bdbe7c843eb2bce8f556dca1f777
--- /dev/null
+++ b/Pages/Demo/Tour.Designer.cs
@@ -0,0 +1,127 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Demo
+{
+ partial class Tour
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ gridPanel1 = new AntdUI.GridPanel();
+ this.btn2 = new AntdUI.Button();
+ this.btn1 = new AntdUI.Button();
+ btnTour = new AntdUI.Button();
+ slider1 = new AntdUI.Slider();
+ calendar1 = new AntdUI.Calendar();
+ gridPanel1.SuspendLayout();
+ SuspendLayout();
+ //
+ // gridPanel1
+ //
+ gridPanel1.Controls.Add(calendar1);
+ gridPanel1.Controls.Add(slider1);
+ gridPanel1.Controls.Add(this.btn2);
+ gridPanel1.Controls.Add(this.btn1);
+ gridPanel1.Controls.Add(btnTour);
+ gridPanel1.Dock = DockStyle.Fill;
+ gridPanel1.Gap = 5;
+ gridPanel1.Location = new Point(0, 0);
+ gridPanel1.Margin = new Padding(4, 4, 4, 4);
+ gridPanel1.Name = "gridPanel1";
+ gridPanel1.Size = new Size(890, 528);
+ gridPanel1.Span = "100%;50% 50%;100%;100%;-70 70 50 100%";
+ gridPanel1.TabIndex = 0;
+ gridPanel1.Text = "gridPanel1";
+ //
+ // btn2
+ //
+ this.btn2.Location = new Point(454, 79);
+ this.btn2.Margin = new Padding(4, 4, 4, 4);
+ this.btn2.Name = "btn2";
+ this.btn2.Size = new Size(427, 52);
+ this.btn2.TabIndex = 2;
+ this.btn2.Text = "步骤 2";
+ //
+ // btn1
+ //
+ this.btn1.Location = new Point(9, 79);
+ this.btn1.Margin = new Padding(4, 4, 4, 4);
+ this.btn1.Name = "btn1";
+ this.btn1.Size = new Size(427, 52);
+ this.btn1.TabIndex = 0;
+ this.btn1.Text = "步骤 1";
+ //
+ // btnTour
+ //
+ btnTour.IconSvg = "BookFilled";
+ btnTour.Location = new Point(9, 9);
+ btnTour.Margin = new Padding(4, 4, 4, 4);
+ btnTour.Name = "btnTour";
+ btnTour.Size = new Size(872, 52);
+ btnTour.TabIndex = 3;
+ btnTour.Text = "引导";
+ //
+ // slider1
+ //
+ slider1.Location = new Point(9, 149);
+ slider1.Margin = new Padding(4, 4, 4, 4);
+ slider1.Name = "slider1";
+ slider1.Size = new Size(872, 32);
+ slider1.TabIndex = 4;
+ slider1.Text = "slider1";
+ //
+ // calendar1
+ //
+ calendar1.Location = new Point(9, 199);
+ calendar1.Margin = new Padding(4, 4, 4, 4);
+ calendar1.Name = "calendar1";
+ calendar1.Size = new Size(872, 320);
+ calendar1.TabIndex = 5;
+ calendar1.Text = "calendar1";
+ calendar1.Value = new DateTime(2025, 2, 14, 13, 41, 59, 516);
+ //
+ // Tour
+ //
+ AutoScaleDimensions = new SizeF(9F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(gridPanel1);
+ Font = new Font("微软雅黑", 11F);
+ Margin = new Padding(4, 4, 4, 4);
+ Name = "Tour";
+ Size = new Size(890, 528);
+ gridPanel1.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private AntdUI.GridPanel gridPanel1;
+ private AntdUI.Button btn1;
+ private AntdUI.Button btn2;
+ private AntdUI.Chat.ChatList chatList1;
+ private AntdUI.Slider slider1;
+ private AntdUI.Button btnTour;
+ private AntdUI.Calendar calendar1;
+ }
+}
diff --git a/Pages/Demo/Tour.cs b/Pages/Demo/Tour.cs
new file mode 100644
index 0000000000000000000000000000000000000000..5581b93c02b87a273b7a7a53475ade7bb9203899
--- /dev/null
+++ b/Pages/Demo/Tour.cs
@@ -0,0 +1,84 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Demo
+{
+ public partial class Tour : UserControl
+ {
+ private AntdUI.TourForm? frmTour;
+
+ public Tour()
+ {
+ InitializeComponent();
+
+ btnTour.Click += (s, e) =>
+ {
+ frmTour = null;
+ OpenTour();
+ };
+ }
+
+ private void OpenTour()
+ {
+ if (frmTour == null)
+ {
+ Form? frmPopover = null;
+
+ frmTour = AntdUI.Tour.open(new AntdUI.Tour.Config(ParentForm!, result =>
+ {
+ switch (result.Index)
+ {
+ case 0:
+ result.Set(btn1);
+ break;
+ case 1:
+ result.Set(btn2);
+ break;
+ case 2:
+ result.Set(slider1);
+ break;
+ case 3:
+ result.Set(calendar1);
+ break;
+ default:
+ result.Close();
+ frmTour = null;
+ break;
+ }
+ }, popover =>
+ {
+ frmPopover?.Close();
+ frmPopover = null;
+
+ if (popover.Rect.HasValue)
+ {
+ var uc = new Uc.TourPopover(popover, "引导", "", popover.Index + 1, 4) { Size = new(450, 320) };
+
+ switch (popover.Index)
+ {
+ case 0:
+ uc.SetContent("这是一个按钮");
+ break;
+ case 1:
+ uc.SetContent("这是另一个按钮");
+ break;
+ case 2:
+ uc.SetContent("这是一个滑块");
+ break;
+ case 3:
+ uc.SetContent("这是一个日历");
+ break;
+ }
+
+ frmPopover = AntdUI.Popover.open(new AntdUI.Popover.Config(popover.Form, uc)
+ {
+ Offset = popover.Rect.Value,
+ Focus = false,
+ });
+ }
+ }));
+ }
+ else
+ {
+ frmTour.Next();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Pages/Demo/Tour.resx b/Pages/Demo/Tour.resx
new file mode 100644
index 0000000000000000000000000000000000000000..8b2ff64a11300290ddac7e7d9bc26e5e0a766508
--- /dev/null
+++ b/Pages/Demo/Tour.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Pages/Demo/Tree.Designer.cs b/Pages/Demo/Tree.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..21109cf736633edf84e789d3bfbc5ea7504bc987
--- /dev/null
+++ b/Pages/Demo/Tree.Designer.cs
@@ -0,0 +1,130 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Demo
+{
+ partial class Tree
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ panelMain = new AntdUI.Panel();
+ splitter1 = new AntdUI.Splitter();
+ tree1 = new AntdUI.Tree();
+ propertyGrid1 = new PropertyGrid();
+ inputDir = new AntdUI.Input();
+ panelMain.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)splitter1).BeginInit();
+ splitter1.Panel1.SuspendLayout();
+ splitter1.Panel2.SuspendLayout();
+ splitter1.SuspendLayout();
+ SuspendLayout();
+ //
+ // panelMain
+ //
+ panelMain.Controls.Add(splitter1);
+ panelMain.Controls.Add(inputDir);
+ panelMain.Dock = DockStyle.Fill;
+ panelMain.Location = new Point(0, 0);
+ panelMain.Name = "panelMain";
+ panelMain.Padding = new Padding(5);
+ panelMain.Size = new Size(685, 423);
+ panelMain.TabIndex = 0;
+ panelMain.Text = "panel1";
+ //
+ // splitter1
+ //
+ splitter1.Dock = DockStyle.Fill;
+ splitter1.FixedPanel = FixedPanel.Panel2;
+ splitter1.Location = new Point(5, 47);
+ splitter1.Name = "splitter1";
+ //
+ // splitter1.Panel1
+ //
+ splitter1.Panel1.Controls.Add(tree1);
+ splitter1.Panel1.Padding = new Padding(5);
+ //
+ // splitter1.Panel2
+ //
+ splitter1.Panel2.Controls.Add(propertyGrid1);
+ splitter1.Panel2.Padding = new Padding(5);
+ splitter1.Size = new Size(675, 371);
+ splitter1.SplitterDistance = 350;
+ splitter1.TabIndex = 3;
+ //
+ // tree1
+ //
+ tree1.Dock = DockStyle.Fill;
+ tree1.Location = new Point(5, 5);
+ tree1.Name = "tree1";
+ tree1.Size = new Size(340, 361);
+ tree1.TabIndex = 1;
+ tree1.Text = "tree1";
+ //
+ // propertyGrid1
+ //
+ propertyGrid1.BackColor = SystemColors.Control;
+ propertyGrid1.Dock = DockStyle.Fill;
+ propertyGrid1.Location = new Point(5, 5);
+ propertyGrid1.Name = "propertyGrid1";
+ propertyGrid1.SelectedObject = tree1;
+ propertyGrid1.Size = new Size(311, 361);
+ propertyGrid1.TabIndex = 2;
+ //
+ // inputDir
+ //
+ inputDir.Dock = DockStyle.Top;
+ inputDir.IconRatio = 1F;
+ inputDir.Location = new Point(5, 5);
+ inputDir.Name = "inputDir";
+ inputDir.PlaceholderText = "文件夹路径";
+ inputDir.PrefixSvg = "FolderOpenFilled";
+ inputDir.Size = new Size(675, 42);
+ inputDir.SuffixSvg = "ReloadOutlined";
+ inputDir.TabIndex = 0;
+ //
+ // Tree
+ //
+ AutoScaleDimensions = new SizeF(7F, 17F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(panelMain);
+ Font = new Font("微软雅黑", 9F);
+ Name = "Tree";
+ Size = new Size(685, 423);
+ panelMain.ResumeLayout(false);
+ splitter1.Panel1.ResumeLayout(false);
+ splitter1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)splitter1).EndInit();
+ splitter1.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private AntdUI.Panel panelMain;
+ private PropertyGrid propertyGrid1;
+ private AntdUI.Tree tree1;
+ private AntdUI.Input inputDir;
+ private AntdUI.Splitter splitter1;
+ }
+}
diff --git a/Pages/Demo/Tree.cs b/Pages/Demo/Tree.cs
new file mode 100644
index 0000000000000000000000000000000000000000..458f9a415d7cfa61c5206fded820e27cd99085a5
--- /dev/null
+++ b/Pages/Demo/Tree.cs
@@ -0,0 +1,106 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Demo
+{
+ public partial class Tree : UserControl
+ {
+ public Tree()
+ {
+ InitializeComponent();
+
+ tree1.BlockNode = true;
+
+ tree1.NodeMouseClick += (s, e) =>
+ {
+ var item = e.Item;
+ if (item == null) return;
+ if (item.Tag is TreeItemTag tag)
+ {
+ if (e.Button == MouseButtons.Left)
+ {
+ AntdUI.Message.info(ParentForm!, $"Expand: {item.Expand}\r\n{item.Text}\r\n{tag.Path}\r\n{item.IconSvg}", default, 2);
+ }
+ }
+ };
+
+ inputDir.PrefixClick += (s, e) =>
+ {
+ var dialog = new FolderBrowserDialog()
+ {
+ SelectedPath = inputDir.Text
+ };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ inputDir.Text = dialog.SelectedPath;
+ LoadTreeItems();
+ }
+ };
+
+ inputDir.SuffixClick += (s, e) =>
+ {
+ LoadTreeItems();
+ };
+ }
+
+ private void LoadTreeItems()
+ {
+ string dir = inputDir.Text;
+
+ if (!Path.Exists(dir)) return;
+
+ tree1.SuspendLayout();
+ tree1.Items.Clear();
+
+ tree1.Spin(config =>
+ {
+ GetTreeItems(null);
+ }, () =>
+ {
+ tree1.ResumeLayout();
+ AntdUI.Message.success(ParentForm!, "加载完毕。", default, 2);
+ });
+ }
+
+ private void GetTreeItems(AntdUI.TreeItem? parent = null)
+ {
+ string dir = "";
+
+ if (parent == null)
+ {
+ dir = inputDir.Text;
+ }
+ else
+ {
+ if (parent.Tag is TreeItemTag _tag)
+ {
+ dir = $"{_tag.Path}";
+ }
+ }
+
+ if (!Path.Exists(dir)) return;
+
+ AntdUI.TreeItem item;
+ TreeItemTag tag;
+ var di = new DirectoryInfo(dir);
+
+ foreach (var _di in di.GetDirectories())
+ {
+ tag = new(1, _di.FullName);
+ item = new AntdUI.TreeItem(_di.Name) { IconSvg = "FolderOutlined", Tag = tag };
+ if (parent == null) tree1.Items.Add(item); else parent.Sub.Add(item);
+ GetTreeItems(item);
+ }
+
+ foreach (var _fi in di.GetFiles())
+ {
+ tag = new(2, _fi.FullName);
+ item = new AntdUI.TreeItem(_fi.Name) { IconSvg = "FileOutlined", Tag = tag };
+ if (parent == null) tree1.Items.Add(item); else parent.Sub.Add(item);
+ }
+ }
+
+ public class TreeItemTag(int type, string? path)
+ {
+ public int Type { get; set; } = type;
+ public string? Path { get; set; } = path;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Pages/Demo/Tree.resx b/Pages/Demo/Tree.resx
new file mode 100644
index 0000000000000000000000000000000000000000..8b2ff64a11300290ddac7e7d9bc26e5e0a766508
--- /dev/null
+++ b/Pages/Demo/Tree.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Pages/Home.Designer.cs b/Pages/Home.Designer.cs
index 3da481ad5d63915a9338425acaaecd64ee27f01e..10d18a4da9d0830a46da6d5e64515d51a7454b93 100644
--- a/Pages/Home.Designer.cs
+++ b/Pages/Home.Designer.cs
@@ -46,6 +46,7 @@
panelMain.Dock = DockStyle.Fill;
panelMain.Location = new Point(0, 0);
panelMain.Name = "panelMain";
+ panelMain.Radius = 0;
panelMain.Size = new Size(585, 333);
panelMain.TabIndex = 0;
panelMain.Text = "panel1";
@@ -104,8 +105,6 @@
//
// Home
//
- AutoScaleDimensions = new SizeF(7F, 17F);
- AutoScaleMode = AutoScaleMode.Font;
Controls.Add(panelMain);
Font = new Font("微软雅黑", 9F);
Name = "Home";
diff --git a/Pages/Home.cs b/Pages/Home.cs
index 6932217fb490a800b1fc37c4a8b22dd22209511c..b426c621d53eb448a4d0726c3fb267f1c5f7bc3f 100644
--- a/Pages/Home.cs
+++ b/Pages/Home.cs
@@ -6,18 +6,23 @@
{
InitializeComponent();
- lbTime.Text = $"{DateTime.Now:yyyy 年 M 月 d 日 HH:mm:ss}";
+ ShowTime();
System.Windows.Forms.Timer timer = new() { Interval = 100 };
timer.Tick += (s, e) =>
{
- lbTime.Text = $"{DateTime.Now:yyyy 年 M 月 d 日 HH:mm:ss}";
+ ShowTime();
};
timer.Start();
- Helpers.Antd.SetBreathingLight(lbInfo, Color.FromArgb(105, 70, 255), Color.FromArgb(255, 137, 4), 1);
- Helpers.Antd.SetBreathingLight(lbTime, Color.FromArgb(105, 70, 255), Color.FromArgb(255, 137, 4), 1);
+ Helpers.Antd.SetBreathingLight(lbInfo, Color.FromArgb(105, 70, 255), Color.Empty, 1);
+ Helpers.Antd.SetBreathingLight(lbTime, Color.FromArgb(105, 70, 255), Color.Empty, 1);
+ }
+
+ private void ShowTime()
+ {
+ lbTime.Text = $"{DateTime.Now:yyyy 年 M 月 d 日 H 时 m 分 s 秒}";
}
}
}
\ No newline at end of file
diff --git a/Pages/TestWithArgs.Designer.cs b/Pages/TestWithArgs.Designer.cs
index 320ad960ac0f26622cb5b54499671d8f99584d14..cf7325d661ea6d3e2974edc1850faf484623a681 100644
--- a/Pages/TestWithArgs.Designer.cs
+++ b/Pages/TestWithArgs.Designer.cs
@@ -34,8 +34,6 @@
//
// TestWithArgs
//
- AutoScaleDimensions = new SizeF(7F, 17F);
- AutoScaleMode = AutoScaleMode.Font;
Name = "TestWithArgs";
Size = new Size(585, 333);
ResumeLayout(false);
diff --git a/Pages/Tools/PerformanceMonitor.Designer.cs b/Pages/Tools/PerformanceMonitor.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..a51fb74bd20ed3e1d061c2c3719055a998161a82
--- /dev/null
+++ b/Pages/Tools/PerformanceMonitor.Designer.cs
@@ -0,0 +1,186 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Tools
+{
+ partial class PerformanceMonitor
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ gridPanelMain = new AntdUI.GridPanel();
+ input1 = new AntdUI.Input();
+ btnMemClear = new AntdUI.Button();
+ inputMem = new AntdUI.InputNumber();
+ lbMem = new AntdUI.Label();
+ lbInfo = new AntdUI.Label();
+ inputInterval = new AntdUI.InputNumber();
+ checkAutoRefresh = new AntdUI.Checkbox();
+ btnRefresh = new AntdUI.Button();
+ tipB = new AntdUI.TooltipComponent();
+ lbMem2 = new AntdUI.Label();
+ gridPanelMain.SuspendLayout();
+ SuspendLayout();
+ //
+ // gridPanelMain
+ //
+ gridPanelMain.Controls.Add(input1);
+ gridPanelMain.Controls.Add(lbMem2);
+ gridPanelMain.Controls.Add(btnMemClear);
+ gridPanelMain.Controls.Add(inputMem);
+ gridPanelMain.Controls.Add(lbMem);
+ gridPanelMain.Controls.Add(lbInfo);
+ gridPanelMain.Controls.Add(inputInterval);
+ gridPanelMain.Controls.Add(checkAutoRefresh);
+ gridPanelMain.Controls.Add(btnRefresh);
+ gridPanelMain.Dock = DockStyle.Fill;
+ gridPanelMain.Gap = 2;
+ gridPanelMain.Location = new Point(0, 0);
+ gridPanelMain.Name = "gridPanelMain";
+ gridPanelMain.Size = new Size(627, 397);
+ gridPanelMain.Span = "50 100 120 100%;80 150 40 100%;100%;-50 50 100%";
+ gridPanelMain.TabIndex = 0;
+ gridPanelMain.Text = "gridPanel1";
+ //
+ // input1
+ //
+ input1.Location = new Point(5, 105);
+ input1.Multiline = true;
+ input1.Name = "input1";
+ input1.ReadOnly = true;
+ input1.Size = new Size(617, 287);
+ input1.TabIndex = 15;
+ //
+ // btnMemClear
+ //
+ btnMemClear.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ btnMemClear.Ghost = true;
+ btnMemClear.IconRatio = 1F;
+ btnMemClear.IconSvg = "DeleteFilled";
+ btnMemClear.Location = new Point(235, 55);
+ btnMemClear.Name = "btnMemClear";
+ btnMemClear.Size = new Size(30, 40);
+ btnMemClear.TabIndex = 14;
+ tipB.SetTip(btnMemClear, "清理内存");
+ btnMemClear.WaveSize = 0;
+ //
+ // inputMem
+ //
+ inputMem.Location = new Point(82, 52);
+ inputMem.Margin = new Padding(0);
+ inputMem.Name = "inputMem";
+ inputMem.ReadOnly = true;
+ inputMem.Size = new Size(146, 46);
+ inputMem.SuffixText = "B";
+ inputMem.TabIndex = 13;
+ inputMem.Text = "0";
+ //
+ // lbMem
+ //
+ lbMem.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ lbMem.Location = new Point(5, 55);
+ lbMem.Name = "lbMem";
+ lbMem.Size = new Size(70, 40);
+ lbMem.TabIndex = 12;
+ lbMem.Text = "内存";
+ //
+ // lbInfo
+ //
+ lbInfo.Location = new Point(275, 5);
+ lbInfo.Name = "lbInfo";
+ lbInfo.Size = new Size(347, 40);
+ lbInfo.TabIndex = 11;
+ //
+ // inputInterval
+ //
+ inputInterval.Location = new Point(152, 2);
+ inputInterval.Margin = new Padding(0);
+ inputInterval.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
+ inputInterval.Name = "inputInterval";
+ inputInterval.PrefixText = "间隔";
+ inputInterval.Size = new Size(116, 46);
+ inputInterval.SuffixText = "秒";
+ inputInterval.TabIndex = 10;
+ inputInterval.Text = "3";
+ inputInterval.Value = new decimal(new int[] { 3, 0, 0, 0 });
+ //
+ // checkAutoRefresh
+ //
+ checkAutoRefresh.Location = new Point(55, 5);
+ checkAutoRefresh.Name = "checkAutoRefresh";
+ checkAutoRefresh.Size = new Size(90, 40);
+ checkAutoRefresh.TabIndex = 8;
+ checkAutoRefresh.Text = "自动刷新";
+ //
+ // btnRefresh
+ //
+ btnRefresh.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ btnRefresh.Ghost = true;
+ btnRefresh.IconRatio = 1F;
+ btnRefresh.IconSvg = "ReloadOutlined";
+ btnRefresh.Location = new Point(5, 5);
+ btnRefresh.Name = "btnRefresh";
+ btnRefresh.Size = new Size(40, 40);
+ btnRefresh.TabIndex = 7;
+ btnRefresh.Type = AntdUI.TTypeMini.Primary;
+ btnRefresh.WaveSize = 0;
+ //
+ // tipB
+ //
+ tipB.ArrowAlign = AntdUI.TAlign.Bottom;
+ //
+ // lbMem2
+ //
+ lbMem2.AutoEllipsis = true;
+ lbMem2.Location = new Point(275, 55);
+ lbMem2.Name = "lbMem2";
+ lbMem2.Size = new Size(347, 40);
+ lbMem2.TabIndex = 16;
+ //
+ // PerformanceMonitor
+ //
+ AutoScaleDimensions = new SizeF(7F, 17F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(gridPanelMain);
+ Font = new Font("微软雅黑", 9F);
+ Name = "PerformanceMonitor";
+ Size = new Size(627, 397);
+ gridPanelMain.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private AntdUI.GridPanel gridPanelMain;
+ private AntdUI.Button btnRefresh;
+ private AntdUI.Checkbox checkAutoRefresh;
+ private AntdUI.Label lbInfo;
+ private AntdUI.InputNumber inputInterval;
+ private AntdUI.InputNumber inputMem;
+ private AntdUI.Label lbMem;
+ private AntdUI.Button btnMemClear;
+ private AntdUI.TooltipComponent tipB;
+ private AntdUI.Input input1;
+ private AntdUI.Label lbMem2;
+ }
+}
diff --git a/Pages/Tools/PerformanceMonitor.cs b/Pages/Tools/PerformanceMonitor.cs
new file mode 100644
index 0000000000000000000000000000000000000000..847274b5446158eb299f4bf195ff243aa82fff73
--- /dev/null
+++ b/Pages/Tools/PerformanceMonitor.cs
@@ -0,0 +1,97 @@
+using System.Diagnostics;
+
+namespace AntdUI_HamburgerMenuTabs.Pages.Tools
+{
+ public partial class PerformanceMonitor : UserControl
+ {
+ private readonly System.Windows.Forms.Timer timer = new();
+
+ public PerformanceMonitor()
+ {
+ InitializeComponent();
+
+ checkAutoRefresh.CheckedChanged += (s, e) =>
+ {
+ if (e.Value) timer.Start();
+ else timer.Stop();
+ };
+
+ inputInterval.ValueChanged += (s, e) =>
+ {
+ if (timer.Enabled) timer.Interval = (int)inputInterval.Value * 1000;
+ };
+
+ timer.Interval = (int)inputInterval.Value * 1000;
+
+ timer.Tick += (s, e) => GetMem();
+
+ btnRefresh.Click += (s, e) => GetInfo();
+
+ btnMemClear.Click += (s, e) => ClearMem();
+ }
+
+ private void GetInfo()
+ {
+ gridPanelMain.Spin((config) =>
+ {
+ GetMem();
+ }, () =>
+ {
+ AntdUI.Message.info(ParentForm!, $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] 数据已更新。", default, 3);
+ });
+ }
+
+ private void GetMem()
+ {
+ try
+ {
+ input1.Clear();
+
+ long mem, size;
+#pragma warning disable IDE0018 // 内联变量声明
+ string unit;
+#pragma warning restore IDE0018 // 内联变量声明
+
+ //mem = GC.GetTotalMemory(false);
+ //size = Common.Common.SizeFormat(mem, out unit);
+ //input1.Text += $"GC.GetTotalMemory() - {size} {unit}";
+
+ Process process = Process.GetCurrentProcess();
+ mem = process.WorkingSet64;
+ size = Common.Common.SizeFormat(mem, out unit);
+ //input1.Text += $"\r\n\r\nProcess.GetCurrentProcess() - WorkingSet64 - {size} {unit}";
+
+ //PerformanceCounter pc = new("Process", "Working Set", Process.GetCurrentProcess().ProcessName);
+ //mem = (long)pc.NextValue();
+ //size = Common.Common.SizeFormat(mem, out unit);
+ //input1.Text += $"\r\n\r\nPerformanceCounter - Working Set - {size} {unit}";
+
+ inputMem.Value = size;
+ inputMem.SuffixText = unit;
+
+ lbMem2.Text = $"更新时间:{DateTime.Now:yyyy-MM-dd HH:mm:ss}";
+ }
+ catch (Exception)
+ {
+
+ }
+ }
+
+ private void ClearMem()
+ {
+ btnMemClear.Spin((config) =>
+ {
+ try
+ {
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ GetMem();
+ }
+ catch (Exception)
+ {
+
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/Pages/Tools/PerformanceMonitor.resx b/Pages/Tools/PerformanceMonitor.resx
new file mode 100644
index 0000000000000000000000000000000000000000..f2cd7180573f1e9a563b9ad764d2a7b207f678bb
--- /dev/null
+++ b/Pages/Tools/PerformanceMonitor.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/Pages/Tools/RandomCode.Designer.cs b/Pages/Tools/RandomCode.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..45e5f0650a4b4b587f61d3caa326dacef9a8448a
--- /dev/null
+++ b/Pages/Tools/RandomCode.Designer.cs
@@ -0,0 +1,230 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Tools
+{
+ partial class RandomCode
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ gridPanelMain = new AntdUI.GridPanel();
+ inputRes = new AntdUI.Input();
+ btnGenerate = new AntdUI.Button();
+ inputCnt = new AntdUI.InputNumber();
+ lbCnt = new AntdUI.Label();
+ inputLen = new AntdUI.InputNumber();
+ lbLen = new AntdUI.Label();
+ panelPool = new AntdUI.Panel();
+ checkSpecial = new AntdUI.Checkbox();
+ checkNum = new AntdUI.Checkbox();
+ checkLower = new AntdUI.Checkbox();
+ checkUpper = new AntdUI.Checkbox();
+ lbPool = new AntdUI.Label();
+ gridPanelMain.SuspendLayout();
+ panelPool.SuspendLayout();
+ SuspendLayout();
+ //
+ // gridPanelMain
+ //
+ gridPanelMain.Controls.Add(inputRes);
+ gridPanelMain.Controls.Add(btnGenerate);
+ gridPanelMain.Controls.Add(inputCnt);
+ gridPanelMain.Controls.Add(lbCnt);
+ gridPanelMain.Controls.Add(inputLen);
+ gridPanelMain.Controls.Add(lbLen);
+ gridPanelMain.Controls.Add(panelPool);
+ gridPanelMain.Controls.Add(lbPool);
+ gridPanelMain.Dock = DockStyle.Fill;
+ gridPanelMain.Gap = 2;
+ gridPanelMain.Location = new Point(0, 0);
+ gridPanelMain.Name = "gridPanelMain";
+ gridPanelMain.Size = new Size(703, 472);
+ gridPanelMain.Span = "80 100%;80 100%;80 100%;100%;100%;-50 50 50 50 100%";
+ gridPanelMain.TabIndex = 0;
+ gridPanelMain.Text = "gridPanel1";
+ //
+ // inputRes
+ //
+ inputRes.AllowClear = true;
+ inputRes.AutoScroll = true;
+ inputRes.Location = new Point(2, 202);
+ inputRes.Margin = new Padding(0);
+ inputRes.Multiline = true;
+ inputRes.Name = "inputRes";
+ inputRes.Size = new Size(699, 268);
+ inputRes.TabIndex = 7;
+ //
+ // btnGenerate
+ //
+ btnGenerate.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ btnGenerate.IconRatio = 1F;
+ btnGenerate.IconSvg = "SlackSquareFilled";
+ btnGenerate.Location = new Point(5, 155);
+ btnGenerate.Name = "btnGenerate";
+ btnGenerate.Size = new Size(693, 40);
+ btnGenerate.TabIndex = 6;
+ btnGenerate.Text = "生成";
+ btnGenerate.Type = AntdUI.TTypeMini.Primary;
+ btnGenerate.WaveSize = 0;
+ //
+ // inputCnt
+ //
+ inputCnt.IconGap = 0.5F;
+ inputCnt.Location = new Point(82, 102);
+ inputCnt.Margin = new Padding(0);
+ inputCnt.MaximumSize = new Size(150, 0);
+ inputCnt.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
+ inputCnt.Name = "inputCnt";
+ inputCnt.PrefixSvg = "ReloadOutlined";
+ inputCnt.Size = new Size(150, 46);
+ inputCnt.TabIndex = 5;
+ inputCnt.Text = "1";
+ inputCnt.ThousandsSeparator = true;
+ inputCnt.Value = new decimal(new int[] { 1, 0, 0, 0 });
+ //
+ // lbCnt
+ //
+ lbCnt.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ lbCnt.Location = new Point(5, 105);
+ lbCnt.Name = "lbCnt";
+ lbCnt.Size = new Size(70, 40);
+ lbCnt.TabIndex = 4;
+ lbCnt.Text = "编码个数";
+ //
+ // inputLen
+ //
+ inputLen.IconGap = 0.5F;
+ inputLen.Location = new Point(82, 52);
+ inputLen.Margin = new Padding(0);
+ inputLen.MaximumSize = new Size(150, 0);
+ inputLen.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
+ inputLen.Name = "inputLen";
+ inputLen.PrefixSvg = "ReloadOutlined";
+ inputLen.Size = new Size(150, 46);
+ inputLen.TabIndex = 3;
+ inputLen.Text = "8";
+ inputLen.Value = new decimal(new int[] { 8, 0, 0, 0 });
+ //
+ // lbLen
+ //
+ lbLen.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ lbLen.Location = new Point(5, 55);
+ lbLen.Name = "lbLen";
+ lbLen.Size = new Size(70, 40);
+ lbLen.TabIndex = 2;
+ lbLen.Text = "编码长度";
+ //
+ // panelPool
+ //
+ panelPool.Controls.Add(checkSpecial);
+ panelPool.Controls.Add(checkNum);
+ panelPool.Controls.Add(checkLower);
+ panelPool.Controls.Add(checkUpper);
+ panelPool.Location = new Point(85, 5);
+ panelPool.Name = "panelPool";
+ panelPool.Padding = new Padding(3);
+ panelPool.Size = new Size(613, 40);
+ panelPool.TabIndex = 1;
+ panelPool.Text = "panel1";
+ //
+ // checkSpecial
+ //
+ checkSpecial.AutoSizeMode = AntdUI.TAutoSize.Width;
+ checkSpecial.Dock = DockStyle.Left;
+ checkSpecial.Location = new Point(254, 3);
+ checkSpecial.Name = "checkSpecial";
+ checkSpecial.Size = new Size(92, 34);
+ checkSpecial.TabIndex = 3;
+ checkSpecial.Text = "特殊字符";
+ //
+ // checkNum
+ //
+ checkNum.AutoSizeMode = AntdUI.TAutoSize.Width;
+ checkNum.Dock = DockStyle.Left;
+ checkNum.Location = new Point(187, 3);
+ checkNum.Name = "checkNum";
+ checkNum.Size = new Size(67, 34);
+ checkNum.TabIndex = 2;
+ checkNum.Text = "数字";
+ //
+ // checkLower
+ //
+ checkLower.AutoSizeMode = AntdUI.TAutoSize.Width;
+ checkLower.Dock = DockStyle.Left;
+ checkLower.Location = new Point(95, 3);
+ checkLower.Name = "checkLower";
+ checkLower.Size = new Size(92, 34);
+ checkLower.TabIndex = 1;
+ checkLower.Text = "小写字母";
+ //
+ // checkUpper
+ //
+ checkUpper.AutoSizeMode = AntdUI.TAutoSize.Width;
+ checkUpper.Dock = DockStyle.Left;
+ checkUpper.Location = new Point(3, 3);
+ checkUpper.Name = "checkUpper";
+ checkUpper.Size = new Size(92, 34);
+ checkUpper.TabIndex = 0;
+ checkUpper.Text = "大写字母";
+ //
+ // lbPool
+ //
+ lbPool.Font = new Font("微软雅黑", 9F, FontStyle.Bold);
+ lbPool.Location = new Point(5, 5);
+ lbPool.Name = "lbPool";
+ lbPool.Size = new Size(70, 40);
+ lbPool.TabIndex = 0;
+ lbPool.Text = "编码池";
+ //
+ // RandomCode
+ //
+ AutoScaleDimensions = new SizeF(7F, 17F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(gridPanelMain);
+ Font = new Font("微软雅黑", 9F);
+ Name = "RandomCode";
+ Size = new Size(703, 472);
+ gridPanelMain.ResumeLayout(false);
+ panelPool.ResumeLayout(false);
+ panelPool.PerformLayout();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private AntdUI.GridPanel gridPanelMain;
+ private AntdUI.Label lbPool;
+ private AntdUI.InputNumber inputLen;
+ private AntdUI.Label lbLen;
+ private AntdUI.Panel panelPool;
+ private AntdUI.Checkbox checkSpecial;
+ private AntdUI.Checkbox checkNum;
+ private AntdUI.Checkbox checkLower;
+ private AntdUI.Checkbox checkUpper;
+ private AntdUI.InputNumber inputCnt;
+ private AntdUI.Label lbCnt;
+ private AntdUI.Button btnGenerate;
+ private AntdUI.Input inputRes;
+ }
+}
diff --git a/Pages/Tools/RandomCode.cs b/Pages/Tools/RandomCode.cs
new file mode 100644
index 0000000000000000000000000000000000000000..50315aeb4e88b1ee336dcb5e21810438eb131795
--- /dev/null
+++ b/Pages/Tools/RandomCode.cs
@@ -0,0 +1,99 @@
+namespace AntdUI_HamburgerMenuTabs.Pages.Tools
+{
+ public partial class RandomCode : UserControl
+ {
+ private const string charsUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ private const string charsLower = "abcdefghijklmnopqrstuvwxyz";
+ private const string charsNum = "0123456789";
+ private const string charsSpecial = "!@#$%&";
+ private string chars = "";
+
+ public RandomCode()
+ {
+ InitializeComponent();
+
+ checkUpper.Checked = true;
+ checkNum.Checked = true;
+
+ inputLen.PrefixClick += (s, e) =>
+ {
+ inputLen.Value = 8;
+ };
+
+ inputCnt.PrefixClick += (s, e) =>
+ {
+ inputCnt.Value = 1;
+ };
+
+ btnGenerate.Click += (s, e) => GenerateRandomCode();
+ }
+
+ private void GenerateRandomCode()
+ {
+ HashSet res = [];
+ Random random = new();
+ DateTime dtStart = DateTime.Now;
+ int timesTotal = 0;
+ int timesIgnore = 0;
+ string msg = "";
+
+ chars = "";
+ if (checkUpper.Checked) chars += charsUpper;
+ if (checkLower.Checked) chars += charsLower;
+ if (checkNum.Checked) chars += charsNum;
+ if (checkSpecial.Checked) chars += charsSpecial;
+ if (chars.Length == 0) return;
+
+ if (inputCnt.Value > (int)Math.Pow(chars.Length, chars.Length))
+ {
+ msg = $"编码池上限为 {(int)Math.Pow(chars.Length, chars.Length)} ,当前待生成编码个数已超出上限!";
+ Helpers.Antd.Msgbox.ShowWarn(ParentForm!, msg, false);
+ return;
+ }
+
+ inputRes.Clear();
+
+ gridPanelMain.Spin((config) =>
+ {
+ while (res.Count < inputCnt.Value)
+ {
+ string str = GenerateRandomString((int)inputLen.Value, random);
+ timesTotal++;
+ if (!res.Add(str))
+ {
+ timesIgnore++;
+ continue;
+ }
+ }
+
+ if (inputCnt.Value <= 100)
+ {
+ inputRes.Text = string.Join(Environment.NewLine, res);
+ }
+ else
+ {
+ inputRes.Text = "数据量太大,取消显示。";
+ }
+
+ res.Clear();
+ }, () =>
+ {
+ GC.Collect();
+ msg = $"生成完毕。\r\n耗时 {(int)(DateTime.Now - dtStart).TotalMilliseconds} 毫秒。\r\n合计尝试生成 {timesTotal} 次,共丢弃 {timesIgnore} 个重复编码,重复概率为 {Math.Round(timesIgnore * 1.0 / timesTotal, 8)}。";
+
+ Helpers.Antd.Msgbox.ShowSuccess(ParentForm!, msg);
+ });
+ }
+
+ private string GenerateRandomString(int length, Random random)
+ {
+ char[] buffer = new char[length];
+
+ for (int i = 0; i < length; i++)
+ {
+ buffer[i] = chars[random.Next(chars.Length)];
+ }
+ return new string(buffer);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Pages/Tools/RandomCode.resx b/Pages/Tools/RandomCode.resx
new file mode 100644
index 0000000000000000000000000000000000000000..8b2ff64a11300290ddac7e7d9bc26e5e0a766508
--- /dev/null
+++ b/Pages/Tools/RandomCode.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Program.cs b/Program.cs
index 276e98534c6306aa4906007a152045a89b758bb3..d4416d78bd5bcd7987873800d5f2dae576f1794f 100644
--- a/Program.cs
+++ b/Program.cs
@@ -8,10 +8,11 @@ namespace AntdUI_HamburgerMenuTabs
[STAThread]
static void Main()
{
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
AntdUI.Config.ShowInWindowByMessage = true;
- ApplicationConfiguration.Initialize();
+ AntdUI.Config.TextRenderingHighQuality = true;
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.Run(new FrmMain());
}
}
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..ecee247f296f9a474e4937214ea17d4a5f2bf4bf
--- /dev/null
+++ b/Properties/Resources.Designer.cs
@@ -0,0 +1,83 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace AntdUI_HamburgerMenuTabs.Properties {
+ using System;
+
+
+ ///
+ /// 一个强类型的资源类,用于查找本地化的字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// 返回此类使用的缓存的 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AntdUI_HamburgerMenuTabs.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// 查找 System.Drawing.Bitmap 类型的本地化资源。
+ ///
+ internal static System.Drawing.Bitmap AntdUI_Button {
+ get {
+ object obj = ResourceManager.GetObject("AntdUI.Button", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查找 System.Drawing.Bitmap 类型的本地化资源。
+ ///
+ internal static System.Drawing.Bitmap CellImage {
+ get {
+ object obj = ResourceManager.GetObject("CellImage", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
new file mode 100644
index 0000000000000000000000000000000000000000..48ea1bf12ee593538ccb6ef38e5c8c335dbcff72
--- /dev/null
+++ b/Properties/Resources.resx
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\Resources\AntdUI.Button.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\CellImage.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/Resources/AntdUI.Button.jpg b/Resources/AntdUI.Button.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..1527049f398e5db68f5c968dbf0581bf343b3080
Binary files /dev/null and b/Resources/AntdUI.Button.jpg differ
diff --git a/Resources/CellImage.jpg b/Resources/CellImage.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..3628d0d04af29e737182b732a689767e6261eec9
Binary files /dev/null and b/Resources/CellImage.jpg differ
diff --git a/Uc/HamburgerMenuTabs.Designer.cs b/Uc/HamburgerMenuTabs.Designer.cs
index 6f49d3f0f2ba4d7c8e420cd8d538276f707a56a2..6a0c19b32a3b275dba134a796edef9a195ce1ba9 100644
--- a/Uc/HamburgerMenuTabs.Designer.cs
+++ b/Uc/HamburgerMenuTabs.Designer.cs
@@ -29,57 +29,25 @@
private void InitializeComponent()
{
AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard();
- panelMain = new AntdUI.Panel();
- panelTabs = new AntdUI.Panel();
tabs1 = new AntdUI.Tabs();
panelMenu = new AntdUI.Panel();
- tlpMenu = new TableLayoutPanel();
menu1 = new AntdUI.Menu();
+ divider1 = new AntdUI.Divider();
panelMenuHeader = new AntdUI.Panel();
inputMenuSearch = new AntdUI.Input();
btnMenuCollapsed = new AntdUI.Button();
- divider1 = new AntdUI.Divider();
tipB = new AntdUI.TooltipComponent();
- panelMain.SuspendLayout();
- panelTabs.SuspendLayout();
panelMenu.SuspendLayout();
- tlpMenu.SuspendLayout();
panelMenuHeader.SuspendLayout();
SuspendLayout();
//
- // panelMain
- //
- panelMain.Controls.Add(panelTabs);
- panelMain.Controls.Add(panelMenu);
- panelMain.Dock = DockStyle.Fill;
- panelMain.Font = new Font("微软雅黑", 9F);
- panelMain.Location = new Point(0, 0);
- panelMain.Name = "panelMain";
- panelMain.Padding = new Padding(5);
- panelMain.Size = new Size(768, 472);
- panelMain.TabIndex = 3;
- panelMain.Text = "panel1";
- //
- // panelTabs
- //
- panelTabs.BorderWidth = 1F;
- panelTabs.Controls.Add(tabs1);
- panelTabs.Dock = DockStyle.Fill;
- panelTabs.Location = new Point(265, 5);
- panelTabs.Name = "panelTabs";
- panelTabs.Shadow = 2;
- panelTabs.Size = new Size(498, 462);
- panelTabs.TabIndex = 1;
- panelTabs.Text = "panel1";
- //
// tabs1
//
tabs1.Dock = DockStyle.Fill;
- tabs1.Font = new Font("微软雅黑", 9F);
tabs1.Gap = 12;
- tabs1.Location = new Point(3, 3);
+ tabs1.Location = new Point(215, 5);
tabs1.Name = "tabs1";
- tabs1.Size = new Size(492, 456);
+ tabs1.Size = new Size(548, 462);
styleCard1.Closable = true;
tabs1.Style = styleCard1;
tabs1.TabIndex = 0;
@@ -88,67 +56,55 @@
// panelMenu
//
panelMenu.BorderWidth = 1F;
- panelMenu.Controls.Add(tlpMenu);
+ panelMenu.Controls.Add(menu1);
+ panelMenu.Controls.Add(divider1);
+ panelMenu.Controls.Add(panelMenuHeader);
panelMenu.Dock = DockStyle.Left;
panelMenu.Location = new Point(5, 5);
panelMenu.Name = "panelMenu";
- panelMenu.padding = new Padding(0, 0, 5, 0);
panelMenu.Padding = new Padding(5);
- panelMenu.Shadow = 2;
- panelMenu.Size = new Size(260, 462);
+ panelMenu.Size = new Size(210, 462);
panelMenu.TabIndex = 0;
- panelMenu.Text = "panel1";
- //
- // tlpMenu
- //
- tlpMenu.ColumnCount = 1;
- tlpMenu.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
- tlpMenu.Controls.Add(menu1, 0, 2);
- tlpMenu.Controls.Add(panelMenuHeader, 0, 0);
- tlpMenu.Controls.Add(divider1, 0, 1);
- tlpMenu.Dock = DockStyle.Fill;
- tlpMenu.Location = new Point(8, 8);
- tlpMenu.Name = "tlpMenu";
- tlpMenu.RowCount = 3;
- tlpMenu.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F));
- tlpMenu.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
- tlpMenu.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
- tlpMenu.Size = new Size(244, 446);
- tlpMenu.TabIndex = 2;
//
// menu1
//
- menu1.AutoCollapse = true;
menu1.Dock = DockStyle.Fill;
menu1.Indent = true;
- menu1.Location = new Point(3, 73);
+ menu1.Location = new Point(6, 56);
menu1.Name = "menu1";
menu1.ShowSubBack = true;
- menu1.Size = new Size(238, 370);
- menu1.TabIndex = 0;
- menu1.Text = "menu1";
+ menu1.Size = new Size(198, 400);
+ menu1.TabIndex = 1;
+ //
+ // divider1
+ //
+ divider1.Dock = DockStyle.Top;
+ divider1.Location = new Point(6, 46);
+ divider1.Name = "divider1";
+ divider1.Size = new Size(198, 10);
+ divider1.TabIndex = 0;
//
// panelMenuHeader
//
panelMenuHeader.Controls.Add(inputMenuSearch);
panelMenuHeader.Controls.Add(btnMenuCollapsed);
- panelMenuHeader.Dock = DockStyle.Fill;
- panelMenuHeader.Location = new Point(3, 3);
+ panelMenuHeader.Dock = DockStyle.Top;
+ panelMenuHeader.Location = new Point(6, 6);
panelMenuHeader.Name = "panelMenuHeader";
- panelMenuHeader.Size = new Size(238, 44);
+ panelMenuHeader.Radius = 0;
+ panelMenuHeader.Size = new Size(198, 40);
panelMenuHeader.TabIndex = 1;
- panelMenuHeader.Text = "panel1";
//
// inputMenuSearch
//
inputMenuSearch.AllowClear = true;
inputMenuSearch.Dock = DockStyle.Fill;
inputMenuSearch.IconRatio = 1F;
- inputMenuSearch.Location = new Point(50, 0);
+ inputMenuSearch.Location = new Point(40, 0);
inputMenuSearch.Name = "inputMenuSearch";
inputMenuSearch.PlaceholderText = "搜索菜单";
inputMenuSearch.PrefixSvg = "SearchOutlined";
- inputMenuSearch.Size = new Size(188, 44);
+ inputMenuSearch.Size = new Size(158, 40);
inputMenuSearch.SuffixSvg = "";
inputMenuSearch.TabIndex = 1;
//
@@ -159,43 +115,29 @@
btnMenuCollapsed.IconSvg = "MenuOutlined";
btnMenuCollapsed.Location = new Point(0, 0);
btnMenuCollapsed.Name = "btnMenuCollapsed";
- btnMenuCollapsed.Size = new Size(50, 44);
+ btnMenuCollapsed.Size = new Size(40, 40);
btnMenuCollapsed.TabIndex = 0;
//
- // divider1
- //
- divider1.Dock = DockStyle.Fill;
- divider1.Location = new Point(3, 53);
- divider1.Name = "divider1";
- divider1.Size = new Size(238, 14);
- divider1.TabIndex = 2;
- //
// tipB
//
tipB.ArrowAlign = AntdUI.TAlign.Bottom;
//
// HamburgerMenuTabs
//
- AutoScaleDimensions = new SizeF(7F, 17F);
- AutoScaleMode = AutoScaleMode.Font;
- Controls.Add(panelMain);
+ Controls.Add(tabs1);
+ Controls.Add(panelMenu);
+ Font = new Font("微软雅黑", 9F);
Name = "HamburgerMenuTabs";
+ Padding = new Padding(5);
Size = new Size(768, 472);
- panelMain.ResumeLayout(false);
- panelTabs.ResumeLayout(false);
panelMenu.ResumeLayout(false);
- tlpMenu.ResumeLayout(false);
panelMenuHeader.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
-
- private AntdUI.Panel panelMain;
- private AntdUI.Panel panelTabs;
private AntdUI.Tabs tabs1;
private AntdUI.Panel panelMenu;
- private TableLayoutPanel tlpMenu;
private AntdUI.Menu menu1;
private AntdUI.Panel panelMenuHeader;
private AntdUI.Input inputMenuSearch;
diff --git a/Uc/HamburgerMenuTabs.cs b/Uc/HamburgerMenuTabs.cs
index 9d8c4f3548b48baffecccd51cdce3d9cfd4e5c23..798048dcc14cac4bd91d1c6476cc70cc2e9243e3 100644
--- a/Uc/HamburgerMenuTabs.cs
+++ b/Uc/HamburgerMenuTabs.cs
@@ -139,13 +139,13 @@
MenuCollapsedAll(null);
inputMenuSearch.Visible = false;
menu1.Collapsed = true;
- panelMenu.Width = 70;
+ panelMenu.Width = (int)((40 + 12) * AntdUI.Config.Dpi);
}
else
{
inputMenuSearch.Visible = true;
menu1.Collapsed = false;
- panelMenu.Width = 260;
+ panelMenu.Width = (int)(210 * AntdUI.Config.Dpi);
}
};
diff --git a/Uc/TourPopover.Designer.cs b/Uc/TourPopover.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..48aba536b79dc5fc22e81b55cfb6c3272c527c5d
--- /dev/null
+++ b/Uc/TourPopover.Designer.cs
@@ -0,0 +1,148 @@
+namespace AntdUI_HamburgerMenuTabs.Uc
+{
+ partial class TourPopover
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ lbTitle = new AntdUI.Label();
+ lbStep = new AntdUI.Label();
+ lbContent = new AntdUI.Label();
+ btnPrevious = new AntdUI.Button();
+ btnNext = new AntdUI.Button();
+ btnClose = new AntdUI.Button();
+ gridPanelMain = new AntdUI.GridPanel();
+ gridPanelMain.SuspendLayout();
+ SuspendLayout();
+ //
+ // lbTitle
+ //
+ lbTitle.Font = new Font("微软雅黑", 16F, FontStyle.Bold);
+ gridPanelMain.SetIndex(lbTitle, 1);
+ lbTitle.Location = new Point(3, 3);
+ lbTitle.Name = "lbTitle";
+ lbTitle.Size = new Size(400, 44);
+ lbTitle.TabIndex = 0;
+ lbTitle.Text = "标题";
+ //
+ // lbStep
+ //
+ gridPanelMain.SetIndex(lbStep, 2);
+ lbStep.Location = new Point(3, 211);
+ lbStep.Name = "lbStep";
+ lbStep.Size = new Size(250, 34);
+ lbStep.TabIndex = 0;
+ lbStep.Text = "步骤";
+ //
+ // lbContent
+ //
+ lbContent.Font = new Font("微软雅黑", 12F);
+ gridPanelMain.SetIndex(lbContent, 1);
+ lbContent.Location = new Point(3, 53);
+ lbContent.Name = "lbContent";
+ lbContent.Size = new Size(400, 152);
+ lbContent.TabIndex = 0;
+ lbContent.Text = "内容";
+ //
+ // btnPrevious
+ //
+ btnPrevious.AutoSizeMode = AntdUI.TAutoSize.Width;
+ btnPrevious.Ghost = true;
+ gridPanelMain.SetIndex(btnPrevious, 3);
+ btnPrevious.LocalizationText = "Previous";
+ btnPrevious.Location = new Point(259, 211);
+ btnPrevious.Name = "btnPrevious";
+ btnPrevious.Size = new Size(62, 34);
+ btnPrevious.TabIndex = 2;
+ btnPrevious.Text = "上一步";
+ btnPrevious.Type = AntdUI.TTypeMini.Primary;
+ btnPrevious.WaveSize = 0;
+ //
+ // btnNext
+ //
+ btnNext.AutoSizeMode = AntdUI.TAutoSize.Width;
+ btnNext.Ghost = true;
+ gridPanelMain.SetIndex(btnNext, 4);
+ btnNext.LocalizationText = "Next";
+ btnNext.Location = new Point(309, 211);
+ btnNext.Name = "btnNext";
+ btnNext.Size = new Size(62, 34);
+ btnNext.TabIndex = 1;
+ btnNext.Text = "下一步";
+ btnNext.Type = AntdUI.TTypeMini.Primary;
+ btnNext.WaveSize = 0;
+ //
+ // btnClose
+ //
+ btnClose.AutoSizeMode = AntdUI.TAutoSize.Width;
+ btnClose.Ghost = true;
+ btnClose.IconSvg = "CloseOutlined";
+ gridPanelMain.SetIndex(btnClose, 5);
+ btnClose.Location = new Point(359, 211);
+ btnClose.Name = "btnClose";
+ btnClose.Size = new Size(38, 34);
+ btnClose.TabIndex = 3;
+ btnClose.Type = AntdUI.TTypeMini.Error;
+ btnClose.WaveSize = 0;
+ //
+ // gridPanelMain
+ //
+ gridPanelMain.Controls.Add(btnClose);
+ gridPanelMain.Controls.Add(btnPrevious);
+ gridPanelMain.Controls.Add(btnNext);
+ gridPanelMain.Controls.Add(lbStep);
+ gridPanelMain.Controls.Add(lbContent);
+ gridPanelMain.Controls.Add(lbTitle);
+ gridPanelMain.Dock = DockStyle.Fill;
+ gridPanelMain.Location = new Point(0, 0);
+ gridPanelMain.Name = "gridPanelMain";
+ gridPanelMain.Size = new Size(406, 248);
+ gridPanelMain.Span = "100%;100%;100% 50 50 50;-50 100% 40";
+ gridPanelMain.TabIndex = 6;
+ gridPanelMain.Text = "gridPanel2";
+ //
+ // TourPopover
+ //
+ Controls.Add(gridPanelMain);
+ Font = new Font("微软雅黑", 9F);
+ Name = "TourPopover";
+ Size = new Size(406, 248);
+ gridPanelMain.ResumeLayout(false);
+ gridPanelMain.PerformLayout();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private AntdUI.Label lbTitle;
+ private AntdUI.Label lbStep;
+ private AntdUI.Label lbContent;
+ private AntdUI.Button btnPrevious;
+ private AntdUI.Button btnNext;
+ private AntdUI.Button btnClose;
+ private AntdUI.GridPanel gridPanelMain;
+ }
+}
\ No newline at end of file
diff --git a/Uc/TourPopover.cs b/Uc/TourPopover.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d57b119e7164708db2998812be875241fd5e6e0c
--- /dev/null
+++ b/Uc/TourPopover.cs
@@ -0,0 +1,61 @@
+namespace AntdUI_HamburgerMenuTabs.Uc
+{
+ public partial class TourPopover : UserControl
+ {
+ private readonly AntdUI.Tour.Popover? popover;
+
+ public TourPopover(AntdUI.Tour.Popover _popover, string title, string content, int step, int max)
+ {
+ InitializeComponent();
+
+ popover = _popover;
+
+ lbTitle.Text = title;
+ lbContent.Text = content;
+ lbStep.Text = $"步骤:{step} / {max}";
+
+ if (step == max)
+ {
+ btnNext.Text = "结束";
+ btnClose.Visible = false;
+ }
+
+ btnNext.Click += (s, e) =>
+ {
+ popover.Tour.Next();
+ };
+
+ if (step > 1)
+ {
+ btnPrevious.Enabled = true;
+ btnPrevious.Text = "上一步";
+ }
+ else
+ {
+ btnPrevious.Enabled = false;
+ btnPrevious.Text = "";
+ }
+
+ if (btnPrevious.Visible)
+ {
+ int w1 = (int)(lbTitle.PSize.Width / AntdUI.Config.Dpi), w = (int)((lbStep.PSize.Width + btnPrevious.PSize.Width + btnNext.PSize.Width) / AntdUI.Config.Dpi);
+ Width = w1 > w ? w1 : w;
+ }
+
+ btnPrevious.Click += (s, e) =>
+ {
+ popover.Tour.Previous();
+ };
+
+ btnClose.Click += (s, e) =>
+ {
+ popover.Tour.Close();
+ };
+ }
+
+ public void SetContent(string content)
+ {
+ lbContent.Text = content;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Uc/TourPopover.resx b/Uc/TourPopover.resx
new file mode 100644
index 0000000000000000000000000000000000000000..8b2ff64a11300290ddac7e7d9bc26e5e0a766508
--- /dev/null
+++ b/Uc/TourPopover.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/bin/Debug/net9.0-windows7.0/AntdUI.dll b/bin/Debug/net9.0-windows7.0/AntdUI.dll
deleted file mode 100644
index 497a7f44d3d6758af16d1f5cb51524250d03f7d2..0000000000000000000000000000000000000000
Binary files a/bin/Debug/net9.0-windows7.0/AntdUI.dll and /dev/null differ
diff --git a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.deps.json b/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.deps.json
deleted file mode 100644
index c773afc77bb0f1b516557a8cf0bf197d6cef204b..0000000000000000000000000000000000000000
--- a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.deps.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "runtimeTarget": {
- "name": ".NETCoreApp,Version=v9.0",
- "signature": ""
- },
- "compilationOptions": {},
- "targets": {
- ".NETCoreApp,Version=v9.0": {
- "AntdUI_HamburgerMenuTabs/1.0.0": {
- "dependencies": {
- "AntdUI": "1.7.13"
- },
- "runtime": {
- "AntdUI_HamburgerMenuTabs.dll": {}
- }
- },
- "AntdUI/1.7.13": {
- "runtime": {
- "lib/net9.0-windows7.0/AntdUI.dll": {
- "assemblyVersion": "1.7.13.0",
- "fileVersion": "1.7.13.0"
- }
- }
- }
- }
- },
- "libraries": {
- "AntdUI_HamburgerMenuTabs/1.0.0": {
- "type": "project",
- "serviceable": false,
- "sha512": ""
- },
- "AntdUI/1.7.13": {
- "type": "package",
- "serviceable": true,
- "sha512": "sha512-YAFuZg+qvUHEETuTZlsImkvlbO6F8cJwlGf6NofTLBDi54u43KjhFq09lTRNRK/HvAyrvGXv3G+4dOJEcfa+3A==",
- "path": "antdui/1.7.13",
- "hashPath": "antdui.1.7.13.nupkg.sha512"
- }
- }
-}
\ No newline at end of file
diff --git a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.dll b/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.dll
deleted file mode 100644
index 18b6b61dd03bfe8d596d1f75c856638d5c82d4cc..0000000000000000000000000000000000000000
Binary files a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.dll and /dev/null differ
diff --git a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.dll.config b/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.dll.config
deleted file mode 100644
index c3f2969e4b00c334c9867fffbe51defea4797801..0000000000000000000000000000000000000000
--- a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.dll.config
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- True
-
-
- 105, 70, 255
-
-
-
-
\ No newline at end of file
diff --git a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.exe b/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.exe
deleted file mode 100644
index 18c51224a063a10b26260b27c3ee5f886e467321..0000000000000000000000000000000000000000
Binary files a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.exe and /dev/null differ
diff --git a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.pdb b/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.pdb
deleted file mode 100644
index d84f1a5f9ae7154524baf603b6dcc15d94571209..0000000000000000000000000000000000000000
Binary files a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.pdb and /dev/null differ
diff --git a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.runtimeconfig.json b/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.runtimeconfig.json
deleted file mode 100644
index 68ec4b93717b2d15eec9a2dbd2f2c5225be885c9..0000000000000000000000000000000000000000
--- a/bin/Debug/net9.0-windows7.0/AntdUI_HamburgerMenuTabs.runtimeconfig.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "runtimeOptions": {
- "tfm": "net9.0",
- "frameworks": [
- {
- "name": "Microsoft.NETCore.App",
- "version": "9.0.0"
- },
- {
- "name": "Microsoft.WindowsDesktop.App",
- "version": "9.0.0"
- }
- ],
- "configProperties": {
- "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
- "CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS": false
- }
- }
-}
\ No newline at end of file