From 9390e7ce8ad0f75852fa3b0b73d8202ed3d01be6 Mon Sep 17 00:00:00 2001 From: czz_y Date: Mon, 2 Sep 2024 17:46:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Alert,=20Tree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AntdUIDemo.csproj | 16 +- Controls/SystemSet.cs | 50 ++++-- MainWindow.cs | 37 +++-- Utils/AppSetting.cs | 65 ++++---- Views/AlertDemo.Designer.cs | 317 ++++++++++++++++++++++++++++++++++++ Views/AlertDemo.cs | 20 +++ Views/AlertDemo.resx | 120 ++++++++++++++ Views/TreeDemo.Designer.cs | 115 +++++++------ appsettings.json | 10 ++ 9 files changed, 628 insertions(+), 122 deletions(-) create mode 100644 Views/AlertDemo.Designer.cs create mode 100644 Views/AlertDemo.cs create mode 100644 Views/AlertDemo.resx create mode 100644 appsettings.json diff --git a/AntdUIDemo.csproj b/AntdUIDemo.csproj index 07c36af..f1552f5 100644 --- a/AntdUIDemo.csproj +++ b/AntdUIDemo.csproj @@ -2,7 +2,7 @@ WinExe - net48 + net48;net8.0-windows true SystemAware true @@ -32,13 +32,10 @@ + - - - - - + True @@ -55,13 +52,12 @@ + + PreserveNewest + PreserveNewest - - - - \ No newline at end of file diff --git a/Controls/SystemSet.cs b/Controls/SystemSet.cs index 94f3357..87363d9 100644 --- a/Controls/SystemSet.cs +++ b/Controls/SystemSet.cs @@ -1,4 +1,5 @@ using AntdUI; +using Newtonsoft.Json.Linq; using AntdUIDemo.Utils; using System; using System.Collections.Generic; @@ -10,6 +11,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.IO; namespace AntdUIDemo.Controls { @@ -40,32 +42,44 @@ namespace AntdUIDemo.Controls private void InitData() { tabs.SelectedIndex = 0; - //色彩模式 - var colormode = ConfigurationManager.AppSettings["ColorMode"]; + + // 读取 appsettings.json 文件 + var configFilePath = "appsettings.json"; + var json = File.ReadAllText(configFilePath); + var jsonObj = JObject.Parse(json); + var appSettings = jsonObj["AppSettings"]; + + // 色彩模式 + var colormode = appSettings["ColorMode"]?.ToString(); var modeIndexMapping = new Dictionary - { - { "Dark", 2 }, - { "Light", 1 }, - { "Auto", 0 } - }; + { + { "Dark", 2 }, + { "Light", 1 }, + { "Auto", 0 } + }; select_colormode.SelectedIndex = modeIndexMapping.ContainsKey(colormode) ? modeIndexMapping[colormode] : 0; - //开启动画 - var animation = ConfigurationManager.AppSettings["Animation"]; + + // 开启动画 + var animation = appSettings["Animation"]?.ToString(); switch_animation.Checked = animation == "True"; - //启用阴影 - var shadow = ConfigurationManager.AppSettings["ShadowEnabled"]; + + // 启用阴影 + var shadow = appSettings["ShadowEnabled"]?.ToString(); switch_shadow.Checked = shadow == "True"; - //隐藏滚动条 - var scrollbar = ConfigurationManager.AppSettings["ScrollBarHide"]; + + // 隐藏滚动条 + var scrollbar = appSettings["ScrollBarHide"]?.ToString(); switch_scrollbar.Checked = scrollbar == "True"; - //消息窗口弹出 - var showinwindow = ConfigurationManager.AppSettings["ShowInWindow"]; + + // 消息窗口弹出 + var showinwindow = appSettings["ShowInWindow"]?.ToString(); switch_showinwindow.Checked = showinwindow == "True"; - //消息偏移 - var offset = ConfigurationManager.AppSettings["ShowOffset"]; - input_offset.Value = decimal.Parse(offset); + + // 消息偏移 + var offset = appSettings["ShowOffset"]?.ToString(); + input_offset.Value = decimal.Parse(offset ?? "0"); } #region 事件 diff --git a/MainWindow.cs b/MainWindow.cs index a1e4a66..233b308 100644 --- a/MainWindow.cs +++ b/MainWindow.cs @@ -1,4 +1,5 @@ using AntdUI; +using Newtonsoft.Json.Linq; using AntdUIDemo.Controls; using AntdUIDemo.Models; using AntdUIDemo.Utils; @@ -8,6 +9,7 @@ using System; using System.Configuration; using System.Drawing; using System.Windows.Forms; +using System.IO; namespace AntdUIDemo { @@ -45,8 +47,14 @@ namespace AntdUIDemo private void LoadAppConfig() { - //加载色彩模式 - var value = ConfigurationManager.AppSettings["ColorMode"]; + // 读取 appsettings.json 文件 + var configFilePath = "appsettings.json"; + var json = File.ReadAllText(configFilePath); + var jsonObj = JObject.Parse(json); + var appSettings = jsonObj["AppSettings"]; + + // 加载色彩模式 + var value = appSettings["ColorMode"]?.ToString(); if (value == "Auto") { ThemeHelper.SetColorMode(this, ThemeHelper.IsLightMode()); @@ -55,20 +63,25 @@ namespace AntdUIDemo { ThemeHelper.SetColorMode(this, value == "Light"); } - //加载动画 - var animation = ConfigurationManager.AppSettings["Animation"]; + + // 加载动画 + var animation = appSettings["Animation"]?.ToString(); AntdUI.Config.Animation = animation == "True"; - //加载阴影 - var shadow = ConfigurationManager.AppSettings["ShadowEnabled"]; + + // 加载阴影 + var shadow = appSettings["ShadowEnabled"]?.ToString(); AntdUI.Config.ShadowEnabled = shadow == "True"; - //滚动条 - var scrollbar = ConfigurationManager.AppSettings["ScrollBarHide"]; + + // 滚动条 + var scrollbar = appSettings["ScrollBarHide"]?.ToString(); AntdUI.Config.ScrollBarHide = scrollbar == "True"; - //窗口内弹出 Message/Notification - var popup = ConfigurationManager.AppSettings["ShowInWindow"]; + + // 窗口内弹出 Message/Notification + var popup = appSettings["ShowInWindow"]?.ToString(); AntdUI.Config.ShowInWindow = popup == "True"; - //通知消息边界偏移量XY(Message/Notification) - var messageOffset = ConfigurationManager.AppSettings["NoticeWindowOffsetXY"]; + + // 通知消息边界偏移量XY(Message/Notification) + var messageOffset = appSettings["NoticeWindowOffsetXY"]?.ToString(); AntdUI.Config.NoticeWindowOffsetXY = Convert.ToInt32(messageOffset); } diff --git a/Utils/AppSetting.cs b/Utils/AppSetting.cs index d719bf0..4ee3bbb 100644 --- a/Utils/AppSetting.cs +++ b/Utils/AppSetting.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json.Linq; +using System; using System.Collections.Generic; using System.Configuration; using System.IO; @@ -10,53 +11,57 @@ namespace AntdUIDemo.Utils { public static class AppSetting { + private static readonly string configFilePath = "appsettings.json"; + public static void UpdateAppSetting(string key, string value) { - // 获取配置文件路径 - string configFilePath = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; - // 检查配置文件是否存在 if (!File.Exists(configFilePath)) { - // 如果文件不存在,可以选择创建默认的配置文件 + // 如果文件不存在,创建默认的配置文件 CreateDefaultConfigFile(configFilePath); } - // 获取当前配置文件 - Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); - // 检查key是否存在,存在则更新,不存在则添加 - if (config.AppSettings.Settings[key] != null) + // 读取并解析现有的 appsettings.json 文件 + var json = File.ReadAllText(configFilePath); + var jsonObj = JObject.Parse(json); + + // 获取或创建 "AppSettings" 节点 + var appSettings = jsonObj["AppSettings"] as JObject; + if (appSettings == null) { - config.AppSettings.Settings[key].Value = value; + appSettings = new JObject(); + jsonObj["AppSettings"] = appSettings; + } + + // 检查 key 是否存在,存在则更新,不存在则添加 + if (appSettings[key] != null) + { + appSettings[key] = value; } else { - config.AppSettings.Settings.Add(key, value); + appSettings.Add(key, value); } - // 保存更改 - config.Save(ConfigurationSaveMode.Modified); - - // 刷新配置节,确保更新被应用 - ConfigurationManager.RefreshSection("appSettings"); + // 保存更改回 appsettings.json 文件 + File.WriteAllText(configFilePath, jsonObj.ToString()); } private static void CreateDefaultConfigFile(string configFilePath) { - // 创建一个新的配置文件,并写入默认的appSettings - var configXml = @" - - - - - - - - - -"; - - File.WriteAllText(configFilePath, configXml); + // 创建一个新的 appsettings.json 文件,并写入默认的 AppSettings + var configJson = @"{ + ""AppSettings"": { + ""ColorMode"": ""Auto"", + ""Animation"": ""True"", + ""ShadowEnabled"": ""True"", + ""ScrollBarHide"": ""False"", + ""ShowInWindow"": ""True"", + ""ShowOffset"": ""0"" + } +}"; + File.WriteAllText(configFilePath, configJson); } } } diff --git a/Views/AlertDemo.Designer.cs b/Views/AlertDemo.Designer.cs new file mode 100644 index 0000000..d2b795e --- /dev/null +++ b/Views/AlertDemo.Designer.cs @@ -0,0 +1,317 @@ +namespace AntdUIDemo.Views +{ + partial class AlertDemo + { + /// + /// 必需的设计器变量。 + /// + 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() + { + this.stackPanel1 = new AntdUI.StackPanel(); + this.flowPanel3 = new AntdUI.FlowPanel(); + this.alert12 = new AntdUI.Alert(); + this.label5 = new AntdUI.Label(); + this.flowPanel1 = new AntdUI.FlowPanel(); + this.alert5 = new AntdUI.Alert(); + this.alert6 = new AntdUI.Alert(); + this.alert7 = new AntdUI.Alert(); + this.alert8 = new AntdUI.Alert(); + this.label4 = new AntdUI.Label(); + this.flowPanel2 = new AntdUI.FlowPanel(); + this.alert4 = new AntdUI.Alert(); + this.alert3 = new AntdUI.Alert(); + this.alert2 = new AntdUI.Alert(); + this.alert1 = new AntdUI.Alert(); + this.label3 = new AntdUI.Label(); + this.divider1 = new AntdUI.Divider(); + this.label2 = new AntdUI.Label(); + this.label1 = new AntdUI.Label(); + this.label6 = new AntdUI.Label(); + this.alert9 = new AntdUI.Alert(); + this.stackPanel1.SuspendLayout(); + this.flowPanel3.SuspendLayout(); + this.flowPanel1.SuspendLayout(); + this.flowPanel2.SuspendLayout(); + this.SuspendLayout(); + // + // stackPanel1 + // + this.stackPanel1.Controls.Add(this.alert9); + this.stackPanel1.Controls.Add(this.label6); + this.stackPanel1.Controls.Add(this.flowPanel3); + this.stackPanel1.Controls.Add(this.label5); + this.stackPanel1.Controls.Add(this.flowPanel1); + this.stackPanel1.Controls.Add(this.label4); + this.stackPanel1.Controls.Add(this.flowPanel2); + this.stackPanel1.Controls.Add(this.label3); + this.stackPanel1.Controls.Add(this.divider1); + this.stackPanel1.Controls.Add(this.label2); + this.stackPanel1.Controls.Add(this.label1); + this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stackPanel1.Location = new System.Drawing.Point(0, 0); + this.stackPanel1.Name = "stackPanel1"; + this.stackPanel1.Size = new System.Drawing.Size(700, 505); + this.stackPanel1.TabIndex = 0; + this.stackPanel1.Text = "stackPanel1"; + this.stackPanel1.Vertical = true; + // + // flowPanel3 + // + this.flowPanel3.Controls.Add(this.alert12); + this.flowPanel3.Location = new System.Drawing.Point(3, 275); + this.flowPanel3.Name = "flowPanel3"; + this.flowPanel3.Size = new System.Drawing.Size(694, 76); + this.flowPanel3.TabIndex = 43; + this.flowPanel3.Text = "flowPanel3"; + // + // alert12 + // + this.alert12.BorderWidth = 2F; + this.alert12.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert12.Icon = AntdUI.TType.Success; + this.alert12.Location = new System.Drawing.Point(3, 3); + this.alert12.Name = "alert12"; + this.alert12.Size = new System.Drawing.Size(498, 70); + this.alert12.TabIndex = 0; + this.alert12.Text = "Success Description Success Description Success Description"; + this.alert12.TextTitle = "Success Text"; + // + // label5 + // + this.label5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(3, 245); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(694, 24); + this.label5.TabIndex = 42; + this.label5.Text = "副文本"; + // + // flowPanel1 + // + this.flowPanel1.Controls.Add(this.alert5); + this.flowPanel1.Controls.Add(this.alert6); + this.flowPanel1.Controls.Add(this.alert7); + this.flowPanel1.Controls.Add(this.alert8); + this.flowPanel1.Location = new System.Drawing.Point(3, 201); + this.flowPanel1.Name = "flowPanel1"; + this.flowPanel1.Size = new System.Drawing.Size(694, 38); + this.flowPanel1.TabIndex = 41; + this.flowPanel1.Text = "flowPanel1"; + // + // alert5 + // + this.alert5.BorderWidth = 2F; + this.alert5.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert5.Icon = AntdUI.TType.Error; + this.alert5.Location = new System.Drawing.Point(381, 3); + this.alert5.Name = "alert5"; + this.alert5.Size = new System.Drawing.Size(120, 32); + this.alert5.TabIndex = 3; + this.alert5.Text = "Error Text"; + // + // alert6 + // + this.alert6.BorderWidth = 2F; + this.alert6.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert6.Icon = AntdUI.TType.Warn; + this.alert6.Location = new System.Drawing.Point(255, 3); + this.alert6.Name = "alert6"; + this.alert6.Size = new System.Drawing.Size(120, 32); + this.alert6.TabIndex = 2; + this.alert6.Text = "Warn Text"; + // + // alert7 + // + this.alert7.BorderWidth = 2F; + this.alert7.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert7.Icon = AntdUI.TType.Info; + this.alert7.Location = new System.Drawing.Point(129, 3); + this.alert7.Name = "alert7"; + this.alert7.Size = new System.Drawing.Size(120, 32); + this.alert7.TabIndex = 1; + this.alert7.Text = "Info Text"; + // + // alert8 + // + this.alert8.BorderWidth = 2F; + this.alert8.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert8.Icon = AntdUI.TType.Success; + this.alert8.Location = new System.Drawing.Point(3, 3); + this.alert8.Name = "alert8"; + this.alert8.Size = new System.Drawing.Size(120, 32); + this.alert8.TabIndex = 0; + this.alert8.Text = "Success Text"; + // + // label4 + // + this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label4.Location = new System.Drawing.Point(3, 171); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(694, 24); + this.label4.TabIndex = 40; + this.label4.Text = "提示边框"; + // + // flowPanel2 + // + this.flowPanel2.Controls.Add(this.alert4); + this.flowPanel2.Controls.Add(this.alert3); + this.flowPanel2.Controls.Add(this.alert2); + this.flowPanel2.Controls.Add(this.alert1); + this.flowPanel2.Location = new System.Drawing.Point(3, 127); + this.flowPanel2.Name = "flowPanel2"; + this.flowPanel2.Size = new System.Drawing.Size(694, 38); + this.flowPanel2.TabIndex = 39; + this.flowPanel2.Text = "flowPanel2"; + // + // alert4 + // + this.alert4.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert4.Icon = AntdUI.TType.Error; + this.alert4.Location = new System.Drawing.Point(381, 3); + this.alert4.Name = "alert4"; + this.alert4.Size = new System.Drawing.Size(120, 32); + this.alert4.TabIndex = 3; + this.alert4.Text = "Error Text"; + // + // alert3 + // + this.alert3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert3.Icon = AntdUI.TType.Warn; + this.alert3.Location = new System.Drawing.Point(255, 3); + this.alert3.Name = "alert3"; + this.alert3.Size = new System.Drawing.Size(120, 32); + this.alert3.TabIndex = 2; + this.alert3.Text = "Warn Text"; + // + // alert2 + // + this.alert2.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert2.Icon = AntdUI.TType.Info; + this.alert2.Location = new System.Drawing.Point(129, 3); + this.alert2.Name = "alert2"; + this.alert2.Size = new System.Drawing.Size(120, 32); + this.alert2.TabIndex = 1; + this.alert2.Text = "Info Text"; + // + // alert1 + // + this.alert1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert1.Icon = AntdUI.TType.Success; + this.alert1.Location = new System.Drawing.Point(3, 3); + this.alert1.Name = "alert1"; + this.alert1.Size = new System.Drawing.Size(120, 32); + this.alert1.TabIndex = 0; + this.alert1.Text = "Success Text"; + // + // label3 + // + this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(3, 97); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(694, 24); + this.label3.TabIndex = 21; + this.label3.Text = "基本用法"; + // + // divider1 + // + this.divider1.Location = new System.Drawing.Point(3, 79); + this.divider1.Name = "divider1"; + this.divider1.Size = new System.Drawing.Size(694, 12); + this.divider1.TabIndex = 20; + // + // label2 + // + this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(3, 49); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(694, 24); + this.label2.TabIndex = 19; + this.label2.Text = "警告提示,展现需要关注的信息。"; + // + // label1 + // + this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(3, 3); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(694, 40); + this.label1.TabIndex = 18; + this.label1.Text = "Alert 警告提示"; + // + // label6 + // + this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(3, 357); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(694, 24); + this.label6.TabIndex = 44; + this.label6.Text = "轮播"; + // + // alert9 + // + this.alert9.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.alert9.Location = new System.Drawing.Point(3, 387); + this.alert9.Loop = true; + this.alert9.Name = "alert9"; + this.alert9.Size = new System.Drawing.Size(694, 32); + this.alert9.TabIndex = 45; + this.alert9.Text = "I can be a React component, multiple React components, or just some text."; + // + // AlertDemo + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; + this.Controls.Add(this.stackPanel1); + this.Name = "AlertDemo"; + this.Size = new System.Drawing.Size(700, 505); + this.stackPanel1.ResumeLayout(false); + this.flowPanel3.ResumeLayout(false); + this.flowPanel1.ResumeLayout(false); + this.flowPanel2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private AntdUI.StackPanel stackPanel1; + private AntdUI.Divider divider1; + private AntdUI.Label label2; + private AntdUI.Label label1; + private AntdUI.Label label3; + private AntdUI.FlowPanel flowPanel2; + private AntdUI.Alert alert1; + private AntdUI.Alert alert4; + private AntdUI.Alert alert3; + private AntdUI.Alert alert2; + private AntdUI.FlowPanel flowPanel1; + private AntdUI.Alert alert5; + private AntdUI.Alert alert6; + private AntdUI.Alert alert7; + private AntdUI.Alert alert8; + private AntdUI.Label label4; + private AntdUI.FlowPanel flowPanel3; + private AntdUI.Alert alert12; + private AntdUI.Label label5; + private AntdUI.Label label6; + private AntdUI.Alert alert9; + } +} diff --git a/Views/AlertDemo.cs b/Views/AlertDemo.cs new file mode 100644 index 0000000..541f1c8 --- /dev/null +++ b/Views/AlertDemo.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AntdUIDemo.Views +{ + public partial class AlertDemo : UserControl + { + public AlertDemo() + { + InitializeComponent(); + } + } +} diff --git a/Views/AlertDemo.resx b/Views/AlertDemo.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Views/AlertDemo.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/Views/TreeDemo.Designer.cs b/Views/TreeDemo.Designer.cs index 7efd919..a994cf1 100644 --- a/Views/TreeDemo.Designer.cs +++ b/Views/TreeDemo.Designer.cs @@ -28,25 +28,26 @@ /// private void InitializeComponent() { - AntdUI.TreeItem treeItem7 = new AntdUI.TreeItem(); - AntdUI.TreeItem treeItem8 = new AntdUI.TreeItem(); - AntdUI.TreeItem treeItem9 = new AntdUI.TreeItem(); - AntdUI.TreeItem treeItem10 = new AntdUI.TreeItem(); - AntdUI.TreeItem treeItem11 = new AntdUI.TreeItem(); - AntdUI.TreeItem treeItem12 = new AntdUI.TreeItem(); AntdUI.TreeItem treeItem1 = new AntdUI.TreeItem(); AntdUI.TreeItem treeItem2 = new AntdUI.TreeItem(); AntdUI.TreeItem treeItem3 = new AntdUI.TreeItem(); AntdUI.TreeItem treeItem4 = new AntdUI.TreeItem(); AntdUI.TreeItem treeItem5 = new AntdUI.TreeItem(); AntdUI.TreeItem treeItem6 = new AntdUI.TreeItem(); + AntdUI.TreeItem treeItem7 = new AntdUI.TreeItem(); + AntdUI.TreeItem treeItem8 = new AntdUI.TreeItem(); + AntdUI.TreeItem treeItem9 = new AntdUI.TreeItem(); + AntdUI.TreeItem treeItem10 = new AntdUI.TreeItem(); + AntdUI.TreeItem treeItem11 = new AntdUI.TreeItem(); + AntdUI.TreeItem treeItem12 = new AntdUI.TreeItem(); this.stackPanel1 = new AntdUI.StackPanel(); this.divider1 = new AntdUI.Divider(); this.label2 = new AntdUI.Label(); this.label1 = new AntdUI.Label(); + this.label3 = new AntdUI.Label(); this.stackPanel2 = new AntdUI.StackPanel(); - this.tree1 = new AntdUI.Tree(); this.tree2 = new AntdUI.Tree(); + this.tree1 = new AntdUI.Tree(); this.stackPanel1.SuspendLayout(); this.stackPanel2.SuspendLayout(); this.SuspendLayout(); @@ -54,6 +55,7 @@ // stackPanel1 // this.stackPanel1.Controls.Add(this.stackPanel2); + this.stackPanel1.Controls.Add(this.label3); this.stackPanel1.Controls.Add(this.divider1); this.stackPanel1.Controls.Add(this.label2); this.stackPanel1.Controls.Add(this.label1); @@ -90,56 +92,25 @@ this.label1.TabIndex = 12; this.label1.Text = "Tree 树形控件"; // + // label3 + // + this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(3, 97); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(694, 24); + this.label3.TabIndex = 16; + this.label3.Text = "基本用法"; + // // stackPanel2 // this.stackPanel2.Controls.Add(this.tree2); this.stackPanel2.Controls.Add(this.tree1); - this.stackPanel2.Location = new System.Drawing.Point(3, 97); + this.stackPanel2.Location = new System.Drawing.Point(3, 127); this.stackPanel2.Name = "stackPanel2"; - this.stackPanel2.Size = new System.Drawing.Size(694, 377); - this.stackPanel2.TabIndex = 15; + this.stackPanel2.Size = new System.Drawing.Size(694, 347); + this.stackPanel2.TabIndex = 17; this.stackPanel2.Text = "stackPanel2"; // - // tree1 - // - this.tree1.Checkable = true; - this.tree1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); - treeItem7.Expand = true; - treeItem7.PARENTITEM = null; - treeItem8.Checked = true; - treeItem8.CheckState = System.Windows.Forms.CheckState.Checked; - treeItem8.Enabled = false; - treeItem8.Expand = true; - treeItem8.PARENTITEM = treeItem7; - treeItem9.Expand = true; - treeItem9.PARENTITEM = treeItem8; - treeItem9.Text = "leaf"; - treeItem10.PARENTITEM = treeItem8; - treeItem10.Text = "leaf"; - treeItem8.Sub.Add(treeItem9); - treeItem8.Sub.Add(treeItem10); - treeItem8.Text = "parent1-0"; - treeItem11.Checked = true; - treeItem11.CheckState = System.Windows.Forms.CheckState.Checked; - treeItem11.Expand = true; - treeItem11.PARENTITEM = treeItem7; - treeItem12.Checked = true; - treeItem12.CheckState = System.Windows.Forms.CheckState.Checked; - treeItem12.Expand = true; - treeItem12.PARENTITEM = treeItem11; - treeItem12.Text = "sss"; - treeItem11.Sub.Add(treeItem12); - treeItem11.Text = "parent1-1"; - treeItem7.Sub.Add(treeItem8); - treeItem7.Sub.Add(treeItem11); - treeItem7.Text = "parent1"; - this.tree1.Items.Add(treeItem7); - this.tree1.Location = new System.Drawing.Point(3, 3); - this.tree1.Name = "tree1"; - this.tree1.Size = new System.Drawing.Size(247, 371); - this.tree1.TabIndex = 0; - this.tree1.Text = "tree1"; - // // tree2 // this.tree2.BlockNode = true; @@ -175,10 +146,49 @@ this.tree2.Items.Add(treeItem1); this.tree2.Location = new System.Drawing.Point(256, 3); this.tree2.Name = "tree2"; - this.tree2.Size = new System.Drawing.Size(247, 371); + this.tree2.Size = new System.Drawing.Size(247, 341); this.tree2.TabIndex = 1; this.tree2.Text = "tree2"; // + // tree1 + // + this.tree1.Checkable = true; + this.tree1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + treeItem7.CheckState = System.Windows.Forms.CheckState.Indeterminate; + treeItem7.Expand = true; + treeItem7.PARENTITEM = null; + treeItem8.Enabled = false; + treeItem8.Expand = true; + treeItem8.PARENTITEM = treeItem7; + treeItem9.Expand = true; + treeItem9.PARENTITEM = treeItem8; + treeItem9.Text = "leaf"; + treeItem10.PARENTITEM = treeItem8; + treeItem10.Text = "leaf"; + treeItem8.Sub.Add(treeItem9); + treeItem8.Sub.Add(treeItem10); + treeItem8.Text = "parent1-0"; + treeItem11.Checked = true; + treeItem11.CheckState = System.Windows.Forms.CheckState.Checked; + treeItem11.Expand = true; + treeItem11.PARENTITEM = treeItem7; + treeItem12.Checked = true; + treeItem12.CheckState = System.Windows.Forms.CheckState.Checked; + treeItem12.Expand = true; + treeItem12.PARENTITEM = treeItem11; + treeItem12.Text = "sss"; + treeItem11.Sub.Add(treeItem12); + treeItem11.Text = "parent1-1"; + treeItem7.Sub.Add(treeItem8); + treeItem7.Sub.Add(treeItem11); + treeItem7.Text = "parent1"; + this.tree1.Items.Add(treeItem7); + this.tree1.Location = new System.Drawing.Point(3, 3); + this.tree1.Name = "tree1"; + this.tree1.Size = new System.Drawing.Size(247, 341); + this.tree1.TabIndex = 0; + this.tree1.Text = "tree1"; + // // TreeDemo // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; @@ -198,7 +208,8 @@ private AntdUI.Label label2; private AntdUI.Label label1; private AntdUI.StackPanel stackPanel2; - private AntdUI.Tree tree1; private AntdUI.Tree tree2; + private AntdUI.Tree tree1; + private AntdUI.Label label3; } } diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..aace2ba --- /dev/null +++ b/appsettings.json @@ -0,0 +1,10 @@ +{ + "AppSettings": { + "ColorMode": "Auto", + "Animation": "True", + "ShadowEnabled": "True", + "ScrollBarHide": "False", + "ShowInWindow": "True", + "ShowOffset": 0 + } +}