diff --git a/AntdUIDemo.csproj b/AntdUIDemo.csproj index 60621ac..54b56d2 100644 --- a/AntdUIDemo.csproj +++ b/AntdUIDemo.csproj @@ -29,7 +29,11 @@ - + + + + + \ No newline at end of file diff --git a/App.config b/App.config new file mode 100644 index 0000000..5afc4c9 --- /dev/null +++ b/App.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Controls/SystemSet.Designer.cs b/Controls/SystemSet.Designer.cs index a1c8cbd..6a8b955 100644 --- a/Controls/SystemSet.Designer.cs +++ b/Controls/SystemSet.Designer.cs @@ -39,10 +39,10 @@ this.switch3 = new AntdUI.Switch(); this.label3 = new AntdUI.Label(); this.stackPanel3 = new AntdUI.StackPanel(); - this.switch2 = new AntdUI.Switch(); + this.switch_animation = new AntdUI.Switch(); this.label2 = new AntdUI.Label(); this.stackPanel2 = new AntdUI.StackPanel(); - this.switch1 = new AntdUI.Switch(); + this.switch_colormode = new AntdUI.Switch(); this.label1 = new AntdUI.Label(); this.tabPage2 = new AntdUI.TabPage(); this.stackPanel6 = new AntdUI.StackPanel(); @@ -88,7 +88,7 @@ // tabs // this.tabs.Alignment = System.Windows.Forms.TabAlignment.Left; - this.tabs.Cursor = System.Windows.Forms.Cursors.Default; + this.tabs.Cursor = System.Windows.Forms.Cursors.Hand; this.tabs.Dock = System.Windows.Forms.DockStyle.Fill; this.tabs.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); this.tabs.Gap = 12; @@ -194,7 +194,7 @@ // // stackPanel3 // - this.stackPanel3.Controls.Add(this.switch2); + this.stackPanel3.Controls.Add(this.switch_animation); this.stackPanel3.Controls.Add(this.label2); this.stackPanel3.Location = new System.Drawing.Point(3, 41); this.stackPanel3.Name = "stackPanel3"; @@ -202,19 +202,19 @@ this.stackPanel3.TabIndex = 1; this.stackPanel3.Text = "stackPanel3"; // - // switch2 + // switch_animation // - this.switch2.AutoCheck = true; - this.switch2.Checked = true; - this.switch2.CheckedText = "是"; - this.switch2.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.switch2.Location = new System.Drawing.Point(129, 3); - this.switch2.Name = "switch2"; - this.switch2.Size = new System.Drawing.Size(75, 26); - this.switch2.TabIndex = 1; - this.switch2.Text = "switch2"; - this.switch2.UnCheckedText = "否"; - this.switch2.WaveSize = 0; + this.switch_animation.AutoCheck = true; + this.switch_animation.Checked = true; + this.switch_animation.CheckedText = "是"; + this.switch_animation.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.switch_animation.Location = new System.Drawing.Point(129, 3); + this.switch_animation.Name = "switch_animation"; + this.switch_animation.Size = new System.Drawing.Size(75, 26); + this.switch_animation.TabIndex = 1; + this.switch_animation.Text = "switch2"; + this.switch_animation.UnCheckedText = "否"; + this.switch_animation.WaveSize = 0; // // label2 // @@ -227,7 +227,7 @@ // // stackPanel2 // - this.stackPanel2.Controls.Add(this.switch1); + this.stackPanel2.Controls.Add(this.switch_colormode); this.stackPanel2.Controls.Add(this.label1); this.stackPanel2.Location = new System.Drawing.Point(3, 3); this.stackPanel2.Name = "stackPanel2"; @@ -235,19 +235,19 @@ this.stackPanel2.TabIndex = 0; this.stackPanel2.Text = "stackPanel2"; // - // switch1 + // switch_colormode // - this.switch1.AutoCheck = true; - this.switch1.Checked = true; - this.switch1.CheckedText = "浅色"; - this.switch1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.switch1.Location = new System.Drawing.Point(129, 3); - this.switch1.Name = "switch1"; - this.switch1.Size = new System.Drawing.Size(75, 26); - this.switch1.TabIndex = 1; - this.switch1.Text = "switch1"; - this.switch1.UnCheckedText = "深色"; - this.switch1.WaveSize = 0; + this.switch_colormode.AutoCheck = true; + this.switch_colormode.Checked = true; + this.switch_colormode.CheckedText = "浅色"; + this.switch_colormode.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.switch_colormode.Location = new System.Drawing.Point(129, 3); + this.switch_colormode.Name = "switch_colormode"; + this.switch_colormode.Size = new System.Drawing.Size(75, 26); + this.switch_colormode.TabIndex = 1; + this.switch_colormode.Text = "switch1"; + this.switch_colormode.UnCheckedText = "深色"; + this.switch_colormode.WaveSize = 0; // // label1 // @@ -531,10 +531,10 @@ private AntdUI.Switch switch3; private AntdUI.Label label3; private AntdUI.StackPanel stackPanel3; - private AntdUI.Switch switch2; + private AntdUI.Switch switch_animation; private AntdUI.Label label2; private AntdUI.StackPanel stackPanel2; - private AntdUI.Switch switch1; + private AntdUI.Switch switch_colormode; private AntdUI.Label label1; private AntdUI.StackPanel stackPanel6; private AntdUI.StackPanel stackPanel7; diff --git a/Controls/SystemSet.cs b/Controls/SystemSet.cs index 456c25d..9189b7e 100644 --- a/Controls/SystemSet.cs +++ b/Controls/SystemSet.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Configuration; using System.Data; using System.Drawing; using System.Linq; @@ -15,6 +16,54 @@ namespace AntdUIDemo.Controls public SystemSet() { InitializeComponent(); + //初始化下拉框 + InitSelectItems(); + //设置默认值 + InitData(); + //绑定事件 + BindingEventHandler(); + } + + private void BindingEventHandler() + { + switch_colormode.CheckedChanged += switch_colormode_CheckedChanged; + } + + private void InitSelectItems() + { + + } + + private void InitData() + { + //色彩模式 + var colormode = ConfigurationManager.AppSettings["ColorMode"]; + switch_colormode.Checked = colormode == "Light"; + //开启动画 + var animation = ConfigurationManager.AppSettings["Animation"]; + switch_animation.Checked = animation == "True"; + } + + private void switch_colormode_CheckedChanged(object sender, bool value) + { + ConfigurationManager.AppSettings["ColorMode"] = value ? "Light" : "Dark"; + if (value) + { + AntdUI.Config.IsLight = true; + BackColor = Color.White; + ForeColor = Color.Black; + } + else + { + AntdUI.Config.IsDark = true;// 设置为深色模式 + BackColor = Color.Black; + ForeColor = Color.White; + } + } + + private void switch_animation_CheckedChanged(object sender, bool value) + { + ConfigurationManager.AppSettings["Animation"] = value ? "True" : "False"; } } } diff --git a/MainWindow.cs b/MainWindow.cs index 0134a63..f9ab198 100644 --- a/MainWindow.cs +++ b/MainWindow.cs @@ -3,6 +3,7 @@ using AntdUIDemo.Controls; using AntdUIDemo.Models; using AntdUIDemo.Views; using System; +using System.Drawing; using System.Windows.Forms; namespace AntdUIDemo @@ -22,14 +23,15 @@ namespace AntdUIDemo private void ButtonSZ_Click(object sender, EventArgs e) { - using(var form = new SystemSet()) + + using (var form = new SystemSet()) { - AntdUI.Modal.open(new AntdUI.Modal.Config(this,"系统设置", form, TType.Info) + AntdUI.Modal.open(new AntdUI.Modal.Config(this, "系统设置", form, TType.Info) { - + CloseIcon = true, + BtnHeight = 0, }); } - } private void LoadMenu() diff --git a/Views/ButtonDemo.Designer.cs b/Views/ButtonDemo.Designer.cs index 9211926..65eee86 100644 --- a/Views/ButtonDemo.Designer.cs +++ b/Views/ButtonDemo.Designer.cs @@ -401,6 +401,7 @@ this.button19.ImageSvg = resources.GetString("button19.ImageSvg"); this.button19.Location = new System.Drawing.Point(160, 3); this.button19.Name = "button19"; + this.button19.RightToLeft = System.Windows.Forms.RightToLeft.No; this.button19.Size = new System.Drawing.Size(75, 32); this.button19.TabIndex = 3; this.button19.Text = "搜索"; @@ -716,6 +717,7 @@ // // button1 // + this.button1.Cursor = System.Windows.Forms.Cursors.Default; this.button1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button1.Location = new System.Drawing.Point(3, 3); this.button1.Name = "button1"; diff --git a/Views/ButtonDemo.resx b/Views/ButtonDemo.resx index b433e67..f21f482 100644 --- a/Views/ButtonDemo.resx +++ b/Views/ButtonDemo.resx @@ -117,21 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - <svg viewBox="64 64 896 896"><path d="M716.3 313.8c19-18.9 19-49.7 0-68.6l-69.9-69.9.1.1c-18.5-18.5-50.3-50.3-95.3-95.2-21.2-20.7-55.5-20.5-76.5.5L80.9 474.2a53.84 53.84 0 000 76.4L474.6 944a54.14 54.14 0 0076.5 0l165.1-165c19-18.9 19-49.7 0-68.6a48.7 48.7 0 00-68.7 0l-125 125.2c-5.2 5.2-13.3 5.2-18.5 0L189.5 521.4c-5.2-5.2-5.2-13.3 0-18.5l314.4-314.2c.4-.4.9-.7 1.3-1.1 5.2-4.1 12.4-3.7 17.2 1.1l125.2 125.1c19 19 49.8 19 68.7 0zM408.6 514.4a106.3 106.2 0 10212.6 0 106.3 106.2 0 10-212.6 0zm536.2-38.6L821.9 353.5c-19-18.9-49.8-18.9-68.7.1a48.4 48.4 0 000 68.6l83 82.9c5.2 5.2 5.2 13.3 0 18.5l-81.8 81.7a48.4 48.4 0 000 68.6 48.7 48.7 0 0068.7 0l121.8-121.7a53.93 53.93 0 00-.1-76.4z"></path></svg> - - - <svg viewBox="64 64 896 896" focusable="false" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg> - - - <svg viewBox="64 64 896 896" focusable="false" data-icon="poweroff" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M705.6 124.9a8 8 0 00-11.6 7.2v64.2c0 5.5 2.9 10.6 7.5 13.6a352.2 352.2 0 0162.2 49.8c32.7 32.8 58.4 70.9 76.3 113.3a355 355 0 0127.9 138.7c0 48.1-9.4 94.8-27.9 138.7a355.92 355.92 0 01-76.3 113.3 353.06 353.06 0 01-113.2 76.4c-43.8 18.6-90.5 28-138.5 28s-94.7-9.4-138.5-28a353.06 353.06 0 01-113.2-76.4A355.92 355.92 0 01184 650.4a355 355 0 01-27.9-138.7c0-48.1 9.4-94.8 27.9-138.7 17.9-42.4 43.6-80.5 76.3-113.3 19-19 39.8-35.6 62.2-49.8 4.7-2.9 7.5-8.1 7.5-13.6V132c0-6-6.3-9.8-11.6-7.2C178.5 195.2 82 339.3 80 506.3 77.2 745.1 272.5 943.5 511.2 944c239 .5 432.8-193.3 432.8-432.4 0-169.2-97-315.7-238.4-386.7zM480 560h64c4.4 0 8-3.6 8-8V88c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z"></path></svg> - - - <svg viewBox="64 64 896 896" focusable="false" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg> - - - <svg viewBox="64 64 896 896" focusable="false" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg> - <svg viewBox="64 64 896 896" focusable="false" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg> @@ -150,4 +135,19 @@ <svg viewBox="64 64 896 896" focusable="false" data-icon="poweroff" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M705.6 124.9a8 8 0 00-11.6 7.2v64.2c0 5.5 2.9 10.6 7.5 13.6a352.2 352.2 0 0162.2 49.8c32.7 32.8 58.4 70.9 76.3 113.3a355 355 0 0127.9 138.7c0 48.1-9.4 94.8-27.9 138.7a355.92 355.92 0 01-76.3 113.3 353.06 353.06 0 01-113.2 76.4c-43.8 18.6-90.5 28-138.5 28s-94.7-9.4-138.5-28a353.06 353.06 0 01-113.2-76.4A355.92 355.92 0 01184 650.4a355 355 0 01-27.9-138.7c0-48.1 9.4-94.8 27.9-138.7 17.9-42.4 43.6-80.5 76.3-113.3 19-19 39.8-35.6 62.2-49.8 4.7-2.9 7.5-8.1 7.5-13.6V132c0-6-6.3-9.8-11.6-7.2C178.5 195.2 82 339.3 80 506.3 77.2 745.1 272.5 943.5 511.2 944c239 .5 432.8-193.3 432.8-432.4 0-169.2-97-315.7-238.4-386.7zM480 560h64c4.4 0 8-3.6 8-8V88c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z"></path></svg> + + <svg viewBox="64 64 896 896"><path d="M716.3 313.8c19-18.9 19-49.7 0-68.6l-69.9-69.9.1.1c-18.5-18.5-50.3-50.3-95.3-95.2-21.2-20.7-55.5-20.5-76.5.5L80.9 474.2a53.84 53.84 0 000 76.4L474.6 944a54.14 54.14 0 0076.5 0l165.1-165c19-18.9 19-49.7 0-68.6a48.7 48.7 0 00-68.7 0l-125 125.2c-5.2 5.2-13.3 5.2-18.5 0L189.5 521.4c-5.2-5.2-5.2-13.3 0-18.5l314.4-314.2c.4-.4.9-.7 1.3-1.1 5.2-4.1 12.4-3.7 17.2 1.1l125.2 125.1c19 19 49.8 19 68.7 0zM408.6 514.4a106.3 106.2 0 10212.6 0 106.3 106.2 0 10-212.6 0zm536.2-38.6L821.9 353.5c-19-18.9-49.8-18.9-68.7.1a48.4 48.4 0 000 68.6l83 82.9c5.2 5.2 5.2 13.3 0 18.5l-81.8 81.7a48.4 48.4 0 000 68.6 48.7 48.7 0 0068.7 0l121.8-121.7a53.93 53.93 0 00-.1-76.4z"></path></svg> + + + <svg viewBox="64 64 896 896" focusable="false" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg> + + + <svg viewBox="64 64 896 896" focusable="false" data-icon="poweroff" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M705.6 124.9a8 8 0 00-11.6 7.2v64.2c0 5.5 2.9 10.6 7.5 13.6a352.2 352.2 0 0162.2 49.8c32.7 32.8 58.4 70.9 76.3 113.3a355 355 0 0127.9 138.7c0 48.1-9.4 94.8-27.9 138.7a355.92 355.92 0 01-76.3 113.3 353.06 353.06 0 01-113.2 76.4c-43.8 18.6-90.5 28-138.5 28s-94.7-9.4-138.5-28a353.06 353.06 0 01-113.2-76.4A355.92 355.92 0 01184 650.4a355 355 0 01-27.9-138.7c0-48.1 9.4-94.8 27.9-138.7 17.9-42.4 43.6-80.5 76.3-113.3 19-19 39.8-35.6 62.2-49.8 4.7-2.9 7.5-8.1 7.5-13.6V132c0-6-6.3-9.8-11.6-7.2C178.5 195.2 82 339.3 80 506.3 77.2 745.1 272.5 943.5 511.2 944c239 .5 432.8-193.3 432.8-432.4 0-169.2-97-315.7-238.4-386.7zM480 560h64c4.4 0 8-3.6 8-8V88c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z"></path></svg> + + + <svg viewBox="64 64 896 896" focusable="false" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg> + + + <svg viewBox="64 64 896 896" focusable="false" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg> + \ No newline at end of file