完善系统设置相关选项

This commit is contained in:
czz_y 2024-08-20 16:33:34 +08:00
parent 18abdd4ab1
commit 32af607f1f
15 changed files with 586 additions and 630 deletions

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ColorMode" value="Light" />
<add key="ColorMode" value="Auto" />
<add key="Animation" value="True" />
<add key="ShadowEnabled" value="True" />
<add key="ScrollBarHide" value="False" />
<add key="ShowInWindow" value="True" />
<add key="ShowOffset" value="0" />
</appSettings>
</configuration>

View File

@ -33,39 +33,25 @@
this.tabPage1 = new AntdUI.TabPage();
this.stackPanel1 = new AntdUI.StackPanel();
this.stackPanel5 = new AntdUI.StackPanel();
this.switch4 = new AntdUI.Switch();
this.switch_scrollbar = new AntdUI.Switch();
this.label4 = new AntdUI.Label();
this.stackPanel4 = new AntdUI.StackPanel();
this.switch3 = new AntdUI.Switch();
this.switch_shadow = new AntdUI.Switch();
this.label3 = new AntdUI.Label();
this.stackPanel3 = new AntdUI.StackPanel();
this.switch_animation = new AntdUI.Switch();
this.label2 = new AntdUI.Label();
this.stackPanel2 = new AntdUI.StackPanel();
this.switch_colormode = new AntdUI.Switch();
this.select_colormode = new AntdUI.Select();
this.label1 = new AntdUI.Label();
this.tabPage2 = new AntdUI.TabPage();
this.stackPanel6 = new AntdUI.StackPanel();
this.stackPanel8 = new AntdUI.StackPanel();
this.inputNumber1 = new AntdUI.InputNumber();
this.input_offset = new AntdUI.InputNumber();
this.label6 = new AntdUI.Label();
this.stackPanel7 = new AntdUI.StackPanel();
this.switch5 = new AntdUI.Switch();
this.switch_showinwindow = new AntdUI.Switch();
this.label5 = new AntdUI.Label();
this.tabPage3 = new AntdUI.TabPage();
this.stackPanel11 = new AntdUI.StackPanel();
this.stackPanel13 = new AntdUI.StackPanel();
this.inputNumber3 = new AntdUI.InputNumber();
this.label10 = new AntdUI.Label();
this.stackPanel12 = new AntdUI.StackPanel();
this.inputNumber2 = new AntdUI.InputNumber();
this.label9 = new AntdUI.Label();
this.stackPanel10 = new AntdUI.StackPanel();
this.select2 = new AntdUI.Select();
this.label8 = new AntdUI.Label();
this.stackPanel9 = new AntdUI.StackPanel();
this.select1 = new AntdUI.Select();
this.label7 = new AntdUI.Label();
this.tabs.SuspendLayout();
this.tabPage1.SuspendLayout();
this.stackPanel1.SuspendLayout();
@ -77,12 +63,6 @@
this.stackPanel6.SuspendLayout();
this.stackPanel8.SuspendLayout();
this.stackPanel7.SuspendLayout();
this.tabPage3.SuspendLayout();
this.stackPanel11.SuspendLayout();
this.stackPanel13.SuspendLayout();
this.stackPanel12.SuspendLayout();
this.stackPanel10.SuspendLayout();
this.stackPanel9.SuspendLayout();
this.SuspendLayout();
//
// tabs
@ -96,7 +76,6 @@
this.tabs.Name = "tabs";
this.tabs.Pages.Add(this.tabPage1);
this.tabs.Pages.Add(this.tabPage2);
this.tabs.Pages.Add(this.tabPage3);
this.tabs.Size = new System.Drawing.Size(620, 420);
this.tabs.Style = styleLine1;
this.tabs.TabIndex = 0;
@ -129,7 +108,7 @@
//
// stackPanel5
//
this.stackPanel5.Controls.Add(this.switch4);
this.stackPanel5.Controls.Add(this.switch_scrollbar);
this.stackPanel5.Controls.Add(this.label4);
this.stackPanel5.Location = new System.Drawing.Point(3, 117);
this.stackPanel5.Name = "stackPanel5";
@ -137,18 +116,18 @@
this.stackPanel5.TabIndex = 3;
this.stackPanel5.Text = "stackPanel5";
//
// switch4
// switch_scrollbar
//
this.switch4.AutoCheck = true;
this.switch4.CheckedText = "是";
this.switch4.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.switch4.Location = new System.Drawing.Point(129, 3);
this.switch4.Name = "switch4";
this.switch4.Size = new System.Drawing.Size(75, 26);
this.switch4.TabIndex = 1;
this.switch4.Text = "switch4";
this.switch4.UnCheckedText = "否";
this.switch4.WaveSize = 0;
this.switch_scrollbar.AutoCheck = true;
this.switch_scrollbar.CheckedText = "是";
this.switch_scrollbar.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.switch_scrollbar.Location = new System.Drawing.Point(129, 3);
this.switch_scrollbar.Name = "switch_scrollbar";
this.switch_scrollbar.Size = new System.Drawing.Size(75, 26);
this.switch_scrollbar.TabIndex = 1;
this.switch_scrollbar.Text = "switch4";
this.switch_scrollbar.UnCheckedText = "否";
this.switch_scrollbar.WaveSize = 0;
//
// label4
//
@ -161,7 +140,7 @@
//
// stackPanel4
//
this.stackPanel4.Controls.Add(this.switch3);
this.stackPanel4.Controls.Add(this.switch_shadow);
this.stackPanel4.Controls.Add(this.label3);
this.stackPanel4.Location = new System.Drawing.Point(3, 79);
this.stackPanel4.Name = "stackPanel4";
@ -169,19 +148,19 @@
this.stackPanel4.TabIndex = 2;
this.stackPanel4.Text = "stackPanel4";
//
// switch3
// switch_shadow
//
this.switch3.AutoCheck = true;
this.switch3.Checked = true;
this.switch3.CheckedText = "是";
this.switch3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.switch3.Location = new System.Drawing.Point(129, 3);
this.switch3.Name = "switch3";
this.switch3.Size = new System.Drawing.Size(75, 26);
this.switch3.TabIndex = 1;
this.switch3.Text = "switch3";
this.switch3.UnCheckedText = "否";
this.switch3.WaveSize = 0;
this.switch_shadow.AutoCheck = true;
this.switch_shadow.Checked = true;
this.switch_shadow.CheckedText = "是";
this.switch_shadow.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.switch_shadow.Location = new System.Drawing.Point(129, 3);
this.switch_shadow.Name = "switch_shadow";
this.switch_shadow.Size = new System.Drawing.Size(75, 26);
this.switch_shadow.TabIndex = 1;
this.switch_shadow.Text = "switch3";
this.switch_shadow.UnCheckedText = "否";
this.switch_shadow.WaveSize = 0;
//
// label3
//
@ -227,7 +206,7 @@
//
// stackPanel2
//
this.stackPanel2.Controls.Add(this.switch_colormode);
this.stackPanel2.Controls.Add(this.select_colormode);
this.stackPanel2.Controls.Add(this.label1);
this.stackPanel2.Location = new System.Drawing.Point(3, 3);
this.stackPanel2.Name = "stackPanel2";
@ -235,19 +214,21 @@
this.stackPanel2.TabIndex = 0;
this.stackPanel2.Text = "stackPanel2";
//
// switch_colormode
// select_colormode
//
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;
this.select_colormode.Items.AddRange(new object[] {
"Auto",
"Light",
"Dark"});
this.select_colormode.List = true;
this.select_colormode.Location = new System.Drawing.Point(129, 3);
this.select_colormode.Name = "select_colormode";
this.select_colormode.SelectedIndex = 0;
this.select_colormode.SelectedValue = "Auto";
this.select_colormode.Size = new System.Drawing.Size(90, 26);
this.select_colormode.TabIndex = 2;
this.select_colormode.Text = "Auto";
this.select_colormode.WaveSize = 0;
//
// label1
//
@ -265,7 +246,7 @@
this.tabPage2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage2.Location = new System.Drawing.Point(87, 3);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(482, 387);
this.tabPage2.Size = new System.Drawing.Size(530, 414);
this.tabPage2.TabIndex = 0;
this.tabPage2.Text = "消息配置";
//
@ -276,29 +257,29 @@
this.stackPanel6.Dock = System.Windows.Forms.DockStyle.Fill;
this.stackPanel6.Location = new System.Drawing.Point(0, 0);
this.stackPanel6.Name = "stackPanel6";
this.stackPanel6.Size = new System.Drawing.Size(482, 387);
this.stackPanel6.Size = new System.Drawing.Size(530, 414);
this.stackPanel6.TabIndex = 0;
this.stackPanel6.Text = "stackPanel6";
this.stackPanel6.Vertical = true;
//
// stackPanel8
//
this.stackPanel8.Controls.Add(this.inputNumber1);
this.stackPanel8.Controls.Add(this.input_offset);
this.stackPanel8.Controls.Add(this.label6);
this.stackPanel8.Location = new System.Drawing.Point(3, 41);
this.stackPanel8.Name = "stackPanel8";
this.stackPanel8.Size = new System.Drawing.Size(476, 32);
this.stackPanel8.Size = new System.Drawing.Size(524, 32);
this.stackPanel8.TabIndex = 5;
this.stackPanel8.Text = "stackPanel8";
//
// inputNumber1
// input_offset
//
this.inputNumber1.Location = new System.Drawing.Point(129, 3);
this.inputNumber1.Name = "inputNumber1";
this.inputNumber1.Size = new System.Drawing.Size(75, 26);
this.inputNumber1.TabIndex = 1;
this.inputNumber1.Text = "0";
this.inputNumber1.WaveSize = 0;
this.input_offset.Location = new System.Drawing.Point(129, 3);
this.input_offset.Name = "input_offset";
this.input_offset.Size = new System.Drawing.Size(75, 26);
this.input_offset.TabIndex = 1;
this.input_offset.Text = "0";
this.input_offset.WaveSize = 0;
//
// label6
//
@ -311,26 +292,26 @@
//
// stackPanel7
//
this.stackPanel7.Controls.Add(this.switch5);
this.stackPanel7.Controls.Add(this.switch_showinwindow);
this.stackPanel7.Controls.Add(this.label5);
this.stackPanel7.Location = new System.Drawing.Point(3, 3);
this.stackPanel7.Name = "stackPanel7";
this.stackPanel7.Size = new System.Drawing.Size(476, 32);
this.stackPanel7.Size = new System.Drawing.Size(524, 32);
this.stackPanel7.TabIndex = 4;
this.stackPanel7.Text = "stackPanel7";
//
// switch5
// switch_showinwindow
//
this.switch5.AutoCheck = true;
this.switch5.CheckedText = "是";
this.switch5.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.switch5.Location = new System.Drawing.Point(129, 3);
this.switch5.Name = "switch5";
this.switch5.Size = new System.Drawing.Size(75, 26);
this.switch5.TabIndex = 1;
this.switch5.Text = "switch5";
this.switch5.UnCheckedText = "否";
this.switch5.WaveSize = 0;
this.switch_showinwindow.AutoCheck = true;
this.switch_showinwindow.CheckedText = "是";
this.switch_showinwindow.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.switch_showinwindow.Location = new System.Drawing.Point(129, 3);
this.switch_showinwindow.Name = "switch_showinwindow";
this.switch_showinwindow.Size = new System.Drawing.Size(75, 26);
this.switch_showinwindow.TabIndex = 1;
this.switch_showinwindow.Text = "switch5";
this.switch_showinwindow.UnCheckedText = "否";
this.switch_showinwindow.WaveSize = 0;
//
// label5
//
@ -341,154 +322,6 @@
this.label5.Text = "窗口内弹出";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.stackPanel11);
this.tabPage3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabPage3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.tabPage3.Location = new System.Drawing.Point(87, 3);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(530, 414);
this.tabPage3.TabIndex = 0;
this.tabPage3.Text = "文本设置";
//
// stackPanel11
//
this.stackPanel11.Controls.Add(this.stackPanel13);
this.stackPanel11.Controls.Add(this.stackPanel12);
this.stackPanel11.Controls.Add(this.stackPanel10);
this.stackPanel11.Controls.Add(this.stackPanel9);
this.stackPanel11.Dock = System.Windows.Forms.DockStyle.Fill;
this.stackPanel11.Location = new System.Drawing.Point(0, 0);
this.stackPanel11.Name = "stackPanel11";
this.stackPanel11.Size = new System.Drawing.Size(530, 414);
this.stackPanel11.TabIndex = 0;
this.stackPanel11.Text = "stackPanel11";
this.stackPanel11.Vertical = true;
//
// stackPanel13
//
this.stackPanel13.Controls.Add(this.inputNumber3);
this.stackPanel13.Controls.Add(this.label10);
this.stackPanel13.Location = new System.Drawing.Point(3, 117);
this.stackPanel13.Name = "stackPanel13";
this.stackPanel13.Size = new System.Drawing.Size(524, 32);
this.stackPanel13.TabIndex = 9;
this.stackPanel13.Text = "stackPanel13";
//
// inputNumber3
//
this.inputNumber3.DecimalPlaces = 2;
this.inputNumber3.Location = new System.Drawing.Point(129, 3);
this.inputNumber3.Name = "inputNumber3";
this.inputNumber3.Size = new System.Drawing.Size(100, 26);
this.inputNumber3.TabIndex = 1;
this.inputNumber3.Text = "1.00";
this.inputNumber3.Value = new decimal(new int[] {
1,
0,
0,
0});
this.inputNumber3.WaveSize = 0;
//
// label10
//
this.label10.Location = new System.Drawing.Point(3, 3);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(120, 26);
this.label10.TabIndex = 0;
this.label10.Text = "DPI";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// stackPanel12
//
this.stackPanel12.Controls.Add(this.inputNumber2);
this.stackPanel12.Controls.Add(this.label9);
this.stackPanel12.Location = new System.Drawing.Point(3, 79);
this.stackPanel12.Name = "stackPanel12";
this.stackPanel12.Size = new System.Drawing.Size(524, 32);
this.stackPanel12.TabIndex = 8;
this.stackPanel12.Text = "stackPanel12";
//
// inputNumber2
//
this.inputNumber2.Location = new System.Drawing.Point(129, 3);
this.inputNumber2.Name = "inputNumber2";
this.inputNumber2.Size = new System.Drawing.Size(100, 26);
this.inputNumber2.TabIndex = 1;
this.inputNumber2.Text = "9";
this.inputNumber2.Value = new decimal(new int[] {
9,
0,
0,
0});
this.inputNumber2.WaveSize = 0;
//
// label9
//
this.label9.Location = new System.Drawing.Point(3, 3);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(120, 26);
this.label9.TabIndex = 0;
this.label9.Text = "字体大小";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// stackPanel10
//
this.stackPanel10.Controls.Add(this.select2);
this.stackPanel10.Controls.Add(this.label8);
this.stackPanel10.Location = new System.Drawing.Point(3, 41);
this.stackPanel10.Name = "stackPanel10";
this.stackPanel10.Size = new System.Drawing.Size(524, 32);
this.stackPanel10.TabIndex = 7;
this.stackPanel10.Text = "stackPanel10";
//
// select2
//
this.select2.List = true;
this.select2.Location = new System.Drawing.Point(129, 3);
this.select2.Name = "select2";
this.select2.Size = new System.Drawing.Size(100, 26);
this.select2.TabIndex = 1;
this.select2.WaveSize = 0;
//
// label8
//
this.label8.Location = new System.Drawing.Point(3, 3);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(120, 26);
this.label8.TabIndex = 0;
this.label8.Text = "默认字体";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// stackPanel9
//
this.stackPanel9.Controls.Add(this.select1);
this.stackPanel9.Controls.Add(this.label7);
this.stackPanel9.Location = new System.Drawing.Point(3, 3);
this.stackPanel9.Name = "stackPanel9";
this.stackPanel9.Size = new System.Drawing.Size(524, 32);
this.stackPanel9.TabIndex = 6;
this.stackPanel9.Text = "stackPanel9";
//
// select1
//
this.select1.List = true;
this.select1.Location = new System.Drawing.Point(129, 3);
this.select1.Name = "select1";
this.select1.Size = new System.Drawing.Size(100, 26);
this.select1.TabIndex = 1;
this.select1.WaveSize = 0;
//
// label7
//
this.label7.Location = new System.Drawing.Point(3, 3);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(120, 26);
this.label7.TabIndex = 0;
this.label7.Text = "文本质量";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// SystemSet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -508,12 +341,6 @@
this.stackPanel6.ResumeLayout(false);
this.stackPanel8.ResumeLayout(false);
this.stackPanel7.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.stackPanel11.ResumeLayout(false);
this.stackPanel13.ResumeLayout(false);
this.stackPanel12.ResumeLayout(false);
this.stackPanel10.ResumeLayout(false);
this.stackPanel9.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -525,37 +352,23 @@
private AntdUI.TabPage tabPage2;
private AntdUI.StackPanel stackPanel1;
private AntdUI.StackPanel stackPanel5;
private AntdUI.Switch switch4;
private AntdUI.Switch switch_scrollbar;
private AntdUI.Label label4;
private AntdUI.StackPanel stackPanel4;
private AntdUI.Switch switch3;
private AntdUI.Switch switch_shadow;
private AntdUI.Label label3;
private AntdUI.StackPanel stackPanel3;
private AntdUI.Switch switch_animation;
private AntdUI.Label label2;
private AntdUI.StackPanel stackPanel2;
private AntdUI.Switch switch_colormode;
private AntdUI.Label label1;
private AntdUI.StackPanel stackPanel6;
private AntdUI.StackPanel stackPanel7;
private AntdUI.Switch switch5;
private AntdUI.Switch switch_showinwindow;
private AntdUI.Label label5;
private AntdUI.StackPanel stackPanel8;
private AntdUI.Label label6;
private AntdUI.InputNumber inputNumber1;
private AntdUI.TabPage tabPage3;
private AntdUI.StackPanel stackPanel11;
private AntdUI.StackPanel stackPanel10;
private AntdUI.Select select2;
private AntdUI.Label label8;
private AntdUI.StackPanel stackPanel9;
private AntdUI.Select select1;
private AntdUI.Label label7;
private AntdUI.StackPanel stackPanel12;
private AntdUI.InputNumber inputNumber2;
private AntdUI.Label label9;
private AntdUI.StackPanel stackPanel13;
private AntdUI.Label label10;
private AntdUI.InputNumber inputNumber3;
private AntdUI.InputNumber input_offset;
private AntdUI.Select select_colormode;
}
}

View File

@ -20,8 +20,6 @@ namespace AntdUIDemo.Controls
{
Window = _window;
InitializeComponent();
//初始化下拉框
InitSelectItems();
//设置默认值
InitData();
//绑定事件
@ -30,48 +28,93 @@ namespace AntdUIDemo.Controls
private void BindingEventHandler()
{
switch_colormode.CheckedChanged += switch_colormode_CheckedChanged;
select_colormode.SelectedIndexChanged += Select_colormode_SelectedIndexChanged;
switch_animation.CheckedChanged += switch_animation_CheckedChanged;
switch_shadow.CheckedChanged += switch_shadow_CheckedChanged;
switch_scrollbar.CheckedChanged += switch_scrollbar_CheckedChanged;
switch_showinwindow.CheckedChanged += switch_showinwindow_CheckedChanged;
input_offset.ValueChanged += Input_offset_ValueChanged;
}
private void InitSelectItems()
private void Input_offset_ValueChanged(object sender, decimal value)
{
AppSetting.UpdateAppSetting("ShowOffset", input_offset.Value.ToString());
AntdUI.Config.NoticeWindowOffsetXY = (int)value;
}
private void switch_showinwindow_CheckedChanged(object sender, bool value)
{
AppSetting.UpdateAppSetting("ShowInWindow", value ? "True" : "False");
AntdUI.Config.ShowInWindow = value;
}
private void switch_scrollbar_CheckedChanged(object sender, bool value)
{
AppSetting.UpdateAppSetting("ScrollBarHide", value ? "True" : "False");
AntdUI.Config.ScrollBarHide = value;
}
private void switch_shadow_CheckedChanged(object sender, bool value)
{
AppSetting.UpdateAppSetting("ShadowEnabled", value ? "True" : "False");
AntdUI.Config.ShadowEnabled = value;
}
private void InitData()
{
tabs.SelectedIndex = 0;
//色彩模式
var colormode = ConfigurationManager.AppSettings["ColorMode"];
switch_colormode.Checked = colormode == "Light";
switch (colormode)
{
case "Dark":
select_colormode.SelectedIndex = 2;
break;
case "Light":
select_colormode.SelectedIndex = 1;
break;
case "Auto":
select_colormode.SelectedIndex = 0;
break;
default:
select_colormode.SelectedIndex = 0;
break;
}
//开启动画
var animation = ConfigurationManager.AppSettings["Animation"];
switch_animation.Checked = animation == "True";
//启用阴影
var shadow = ConfigurationManager.AppSettings["ShadowEnabled"];
switch_shadow.Checked = shadow == "True";
//隐藏滚动条
var scrollbar = ConfigurationManager.AppSettings["ScrollBarHide"];
switch_scrollbar.Checked = scrollbar == "True";
//消息窗口弹出
var showinwindow = ConfigurationManager.AppSettings["ShowInWindow"];
switch_showinwindow.Checked = showinwindow == "True";
//消息偏移
var offset = ConfigurationManager.AppSettings["ShowOffset"];
input_offset.Value = decimal.Parse(offset);
}
private void switch_colormode_CheckedChanged(object sender, bool value)
private void Select_colormode_SelectedIndexChanged(object sender, int value)
{
AppSetting.UpdateAppSetting("ColorMode", value ? "Light" : "Dark");
if (value)
AppSetting.UpdateAppSetting("ColorMode", select_colormode.SelectedValue.ToString());
if (value == 0)
{
AntdUI.Config.IsLight = true;
Window.BackColor = Color.White;
Window.ForeColor = Color.FromArgb(17, 17, 17);
BackColor = Color.White;
ForeColor = Color.FromArgb(17, 17, 17);
ThemeHelper.SetColorMode(Window, ThemeHelper.IsLightMode());
}
else
{
AntdUI.Config.IsDark = true;// 设置为深色模式
Window.BackColor = Color.FromArgb(17, 17, 17);
Window.ForeColor = Color.White;
BackColor = Color.FromArgb(17, 17, 17);
ForeColor = Color.White;
ThemeHelper.SetColorMode(Window, value == 1);
}
}
private void switch_animation_CheckedChanged(object sender, bool value)
{
AppSetting.UpdateAppSetting("ColorMode", value ? "Light" : "Dark");
AppSetting.UpdateAppSetting("Animation", switch_animation.Checked.ToString());
AntdUI.Config.Animation = value;
}
}
}

View File

@ -3,6 +3,7 @@ using AntdUIDemo.Controls;
using AntdUIDemo.Models;
using AntdUIDemo.Utils;
using AntdUIDemo.Views;
using Microsoft.Win32;
using System;
using System.Configuration;
using System.Drawing;
@ -17,60 +18,87 @@ namespace AntdUIDemo
{
InitializeComponent();
AntdUI.Config.ShowInWindow = true;
//加载色彩模式
LoadColorMode();
//加载配置文件
LoadAppConfig();
//加载菜单
LoadMenu();
buttonSZ.Click += ButtonSZ_Click;
button_color.Click += Button_color_Click;
menu.SelectChanged += Menu_SelectChanged;
//绑定事件
BindEventHandler();
}
private void LoadColorMode()
private void BindEventHandler()
{
buttonSZ.Click += ButtonSZ_Click;
button_color.Click += Button_color_Click;
menu.SelectChanged += Menu_SelectChanged;
//监听系统深浅色变化
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
}
private void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
if (e.Category == UserPreferenceCategory.General)
{
ThemeHelper.SetColorMode(this, ThemeHelper.IsLightMode());
}
}
private void LoadAppConfig()
{
//加载色彩模式
var value = ConfigurationManager.AppSettings["ColorMode"];
if (value == "Dark")
if (value == "Auto")
{
AntdUI.Config.IsDark = true;// 设置为深色模式
BackColor = Color.FromArgb(17, 17, 17);
ForeColor = Color.White;
ThemeHelper.SetColorMode(this, ThemeHelper.IsLightMode());
}
else
{
AntdUI.Config.IsLight = true;
BackColor = Color.White;
ForeColor = Color.FromArgb(17, 17, 17);
ThemeHelper.SetColorMode(this, value == "Light");
}
//加载动画
var animation = ConfigurationManager.AppSettings["Animation"];
AntdUI.Config.Animation = animation == "True";
//加载阴影
var shadow = ConfigurationManager.AppSettings["ShadowEnabled"];
AntdUI.Config.ShadowEnabled = shadow == "True";
//滚动条
var scrollbar = ConfigurationManager.AppSettings["ScrollBarHide"];
AntdUI.Config.ScrollBarHide = scrollbar == "True";
//窗口内弹出 Message/Notification
var popup = ConfigurationManager.AppSettings["ShowInWindow"];
AntdUI.Config.ShowInWindow = popup == "True";
//通知消息边界偏移量XYMessage/Notification
var messageOffset = ConfigurationManager.AppSettings["NoticeWindowOffsetXY"];
AntdUI.Config.NoticeWindowOffsetXY = Convert.ToInt32(messageOffset);
}
private void Button_color_Click(object sender, EventArgs e)
{
var value = ConfigurationManager.AppSettings["ColorMode"];
AppSetting.UpdateAppSetting("ColorMode", value == "Dark" ? "Light" : "Dark");
if (value == "Dark")
if (value == "Auto")
{
AntdUI.Config.IsLight = true;
BackColor = Color.White;
ForeColor = Color.FromArgb(17, 17, 17);
//反向设置
ThemeHelper.SetColorMode(this, !ThemeHelper.IsLightMode());
AppSetting.UpdateAppSetting("ColorMode", ThemeHelper.IsLightMode() ? "Dark" : "Light");
}
else
{
AntdUI.Config.IsDark = true;// 设置为深色模式
BackColor = Color.FromArgb(17, 17, 17);
ForeColor = Color.White;
ThemeHelper.SetColorMode(this, value == "Dark");
AppSetting.UpdateAppSetting("ColorMode", value == "Dark" ? "Light" : "Dark");
}
}
private void ButtonSZ_Click(object sender, EventArgs e)
{
using (var form = new SystemSet(this))
{
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "系统设置", form, TType.Info)
{
CloseIcon = true,
BtnHeight = 0,
Keyboard = false,
MaskClosable = false,
});
}
}

45
Utils/ThemeHelper.cs Normal file
View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
namespace AntdUIDemo.Utils
{
public static class ThemeHelper
{
public static bool IsLightMode()
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
if (key != null)
{
int appsUseLightTheme = (int)key.GetValue("AppsUseLightTheme", -1);
if (appsUseLightTheme == 1)
{
return true;
}
return false;
}
return true;
}
public static void SetColorMode(AntdUI.Window window, bool isLight)
{
if (!isLight)
{
AntdUI.Config.IsDark = true;// 设置为深色模式
window.BackColor = Color.FromArgb(31, 31, 31);
window.ForeColor = Color.White;
}
else
{
AntdUI.Config.IsLight = true;
window.BackColor = Color.White;
window.ForeColor = Color.Black;
}
}
}
}

View File

@ -62,7 +62,6 @@
this.stackPanel2 = new AntdUI.StackPanel();
this.buttonCZ = new AntdUI.Button();
this.buttonClose = new AntdUI.Button();
this.buttonOpen = new AntdUI.Button();
this.divider1 = new AntdUI.Divider();
this.label3 = new AntdUI.Label();
this.label2 = new AntdUI.Label();
@ -438,7 +437,6 @@
//
this.stackPanel2.Controls.Add(this.buttonCZ);
this.stackPanel2.Controls.Add(this.buttonClose);
this.stackPanel2.Controls.Add(this.buttonOpen);
this.stackPanel2.Location = new System.Drawing.Point(3, 127);
this.stackPanel2.Name = "stackPanel2";
this.stackPanel2.Size = new System.Drawing.Size(694, 38);
@ -448,7 +446,7 @@
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(165, 3);
this.buttonCZ.Location = new System.Drawing.Point(84, 3);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(75, 32);
this.buttonCZ.TabIndex = 4;
@ -459,7 +457,7 @@
// buttonClose
//
this.buttonClose.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonClose.Location = new System.Drawing.Point(84, 3);
this.buttonClose.Location = new System.Drawing.Point(3, 3);
this.buttonClose.Name = "buttonClose";
this.buttonClose.Size = new System.Drawing.Size(75, 32);
this.buttonClose.TabIndex = 3;
@ -467,17 +465,6 @@
this.buttonClose.Type = AntdUI.TTypeMini.Error;
this.buttonClose.WaveSize = 0;
//
// buttonOpen
//
this.buttonOpen.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonOpen.Location = new System.Drawing.Point(3, 3);
this.buttonOpen.Name = "buttonOpen";
this.buttonOpen.Size = new System.Drawing.Size(75, 32);
this.buttonOpen.TabIndex = 2;
this.buttonOpen.Text = "开 启";
this.buttonOpen.Type = AntdUI.TTypeMini.Primary;
this.buttonOpen.WaveSize = 0;
//
// divider1
//
this.divider1.Location = new System.Drawing.Point(3, 109);
@ -568,7 +555,6 @@
private AntdUI.StackPanel stackPanel2;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonClose;
private AntdUI.Button buttonOpen;
private AntdUI.Divider divider1;
}
}

View File

@ -17,8 +17,8 @@ namespace AntdUIDemo.Views
InitSelectItems();
//设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
// 绑定事件
BindEventHandler();
}
private void FloatButtonDemo_Load(object sender, EventArgs e)
@ -27,11 +27,26 @@ namespace AntdUIDemo.Views
LoadFloatButton();
}
private void BindButtonClick()
private void BindEventHandler()
{
buttonOpen.Click += buttonOpen_Click;
buttonClose.Click += buttonClose_Click;
buttonCZ.Click += buttonCZ_Click;
select_align.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
select_round.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
select_topmost.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
select_vertical.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
select_type.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
input_size.ValueChanged += input_decimalvalue_ValeChanged;
input_mx.ValueChanged += input_decimalvalue_ValeChanged;
input_my.ValueChanged += input_decimalvalue_ValeChanged;
input_radius.ValueChanged += input_decimalvalue_ValeChanged;
input_badgesize.ValueChanged += input_decimalvalue_ValeChanged;
input_badge.TextChanged += input_badge_TextChanged;
colorPicker.ValueChanged += colorPicker_ValueChanged;
}
// 初始化下拉框
@ -157,17 +172,38 @@ namespace AntdUIDemo.Views
LoadFloatButton();
}
// 设置
private void buttonOpen_Click(object sender, EventArgs e)
{
CloseFloatButtonForm();
LoadFloatButton();
}
// 关闭
private void buttonClose_Click(object sender, EventArgs e)
{
CloseFloatButtonForm();
}
#region EventHandler
private void select_intvalue_SelectedIndexChanged(object sender, int value)
{
CloseFloatButtonForm();
LoadFloatButton();
}
private void colorPicker_ValueChanged(object sender, Color value)
{
CloseFloatButtonForm();
LoadFloatButton();
}
private void input_badge_TextChanged(object sender, EventArgs e)
{
CloseFloatButtonForm();
LoadFloatButton();
}
private void input_decimalvalue_ValeChanged(object sender, decimal value)
{
CloseFloatButtonForm();
LoadFloatButton();
}
#endregion
}
}

View File

@ -34,8 +34,6 @@
this.stackPanel3 = new AntdUI.StackPanel();
this.buttonDEL = new AntdUI.Button();
this.buttonADD = new AntdUI.Button();
this.buttonCZ = new AntdUI.Button();
this.buttonSZ = new AntdUI.Button();
this.stackPanel6 = new AntdUI.StackPanel();
this.select_autoscroll = new AntdUI.Select();
this.label4 = new AntdUI.Label();
@ -48,6 +46,7 @@
this.divider1 = new AntdUI.Divider();
this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label();
this.buttonCZ = new AntdUI.Button();
this.stackPanel1.SuspendLayout();
this.stackPanel2.SuspendLayout();
this.stackPanel3.SuspendLayout();
@ -82,7 +81,6 @@
//
// flowPanel
//
this.flowPanel.BackColor = System.Drawing.Color.White;
this.flowPanel.Badge = "";
this.flowPanel.Location = new System.Drawing.Point(289, 3);
this.flowPanel.Name = "flowPanel";
@ -91,10 +89,9 @@
//
// stackPanel3
//
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonDEL);
this.stackPanel3.Controls.Add(this.buttonADD);
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonSZ);
this.stackPanel3.Controls.Add(this.stackPanel6);
this.stackPanel3.Controls.Add(this.stackPanel5);
this.stackPanel3.Controls.Add(this.stackPanel4);
@ -108,7 +105,7 @@
// buttonDEL
//
this.buttonDEL.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonDEL.Location = new System.Drawing.Point(3, 231);
this.buttonDEL.Location = new System.Drawing.Point(3, 155);
this.buttonDEL.Name = "buttonDEL";
this.buttonDEL.Size = new System.Drawing.Size(274, 32);
this.buttonDEL.TabIndex = 36;
@ -119,7 +116,7 @@
// buttonADD
//
this.buttonADD.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonADD.Location = new System.Drawing.Point(3, 193);
this.buttonADD.Location = new System.Drawing.Point(3, 117);
this.buttonADD.Name = "buttonADD";
this.buttonADD.Size = new System.Drawing.Size(274, 32);
this.buttonADD.TabIndex = 35;
@ -127,28 +124,6 @@
this.buttonADD.Type = AntdUI.TTypeMini.Info;
this.buttonADD.WaveSize = 0;
//
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 155);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 34;
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
//
// buttonSZ
//
this.buttonSZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonSZ.Location = new System.Drawing.Point(3, 117);
this.buttonSZ.Name = "buttonSZ";
this.buttonSZ.Size = new System.Drawing.Size(274, 32);
this.buttonSZ.TabIndex = 33;
this.buttonSZ.Text = "设 置";
this.buttonSZ.Type = AntdUI.TTypeMini.Primary;
this.buttonSZ.WaveSize = 0;
//
// stackPanel6
//
this.stackPanel6.Controls.Add(this.select_autoscroll);
@ -267,6 +242,17 @@
this.label1.TabIndex = 4;
this.label1.Text = "FlowPanel 流动布局";
//
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 193);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 37;
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
//
// FlowPanelDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
@ -302,9 +288,8 @@
private AntdUI.StackPanel stackPanel6;
private AntdUI.Select select_autoscroll;
private AntdUI.Label label4;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonSZ;
private AntdUI.Button buttonDEL;
private AntdUI.Button buttonADD;
private AntdUI.Button buttonCZ;
}
}

View File

@ -16,8 +16,8 @@ namespace AntdUIDemo.Views
InitSelectItems();
//设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
// 绑定事件
BindEventHandler();
}
private void FlowPanelDemo_Load(object sender, EventArgs e)
@ -60,12 +60,27 @@ namespace AntdUIDemo.Views
}
// 绑定按钮事件
private void BindButtonClick()
private void BindEventHandler()
{
buttonSZ.Click += buttonSZ_Click;
buttonCZ.Click += buttonCZ_Click;
buttonADD.Click += buttonADD_Click;
buttonDEL.Click += buttonDEL_Click;
select_align.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
select_autoscroll.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
input_gap.ValueChanged += input_gap_ValueChanged;
}
private void select_intvalue_SelectedIndexChanged(object sender, int value)
{
flowPanel.Align = (TAlignFlow)select_align.SelectedValue;
flowPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
}
private void input_gap_ValueChanged(object sender, decimal value)
{
flowPanel.Gap = (int)input_gap.Value;
}
// 初始化下拉框
@ -105,14 +120,6 @@ namespace AntdUIDemo.Views
}
}
// 设置
private void buttonSZ_Click(object sender, EventArgs e)
{
flowPanel.Align = (TAlignFlow)select_align.SelectedValue;
flowPanel.Gap = (int)input_gap.Value;
flowPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
}
// 重置
private void buttonCZ_Click(object sender, EventArgs e)
{

View File

@ -33,7 +33,6 @@
this.gridPanel = new AntdUI.GridPanel();
this.stackPanel3 = new AntdUI.StackPanel();
this.buttonCZ = new AntdUI.Button();
this.buttonSZ = new AntdUI.Button();
this.stackPanel4 = new AntdUI.StackPanel();
this.input_gap = new AntdUI.InputNumber();
this.label4 = new AntdUI.Label();
@ -76,7 +75,6 @@
//
// gridPanel
//
this.gridPanel.BackColor = System.Drawing.Color.White;
this.gridPanel.Location = new System.Drawing.Point(289, 3);
this.gridPanel.Name = "gridPanel";
this.gridPanel.Size = new System.Drawing.Size(400, 293);
@ -86,7 +84,6 @@
// stackPanel3
//
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonSZ);
this.stackPanel3.Controls.Add(this.stackPanel4);
this.stackPanel3.Controls.Add(this.stackPanel5);
this.stackPanel3.Location = new System.Drawing.Point(3, 3);
@ -99,7 +96,7 @@
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 136);
this.buttonCZ.Location = new System.Drawing.Point(3, 98);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 20;
@ -107,17 +104,6 @@
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
//
// buttonSZ
//
this.buttonSZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonSZ.Location = new System.Drawing.Point(3, 98);
this.buttonSZ.Name = "buttonSZ";
this.buttonSZ.Size = new System.Drawing.Size(274, 32);
this.buttonSZ.TabIndex = 19;
this.buttonSZ.Text = "设 置";
this.buttonSZ.Type = AntdUI.TTypeMini.Primary;
this.buttonSZ.WaveSize = 0;
//
// stackPanel4
//
this.stackPanel4.Controls.Add(this.input_gap);
@ -230,7 +216,6 @@
private AntdUI.Input input_span;
private AntdUI.Label label3;
private AntdUI.GridPanel gridPanel;
private AntdUI.Button buttonSZ;
private AntdUI.StackPanel stackPanel4;
private AntdUI.InputNumber input_gap;
private AntdUI.Label label4;

View File

@ -12,8 +12,8 @@ namespace AntdUIDemo.Views
InitializeComponent();
//设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
// 绑定事件
BindEventHandler();
}
private void GridPanelDemo_Load(object sender, EventArgs e)
@ -27,13 +27,20 @@ namespace AntdUIDemo.Views
input_span.Text = "50% 50%;50% 50%";
}
private void BindButtonClick()
private void BindEventHandler()
{
buttonSZ.Click += buttonSZ_Click;
buttonCZ.Click += buttonCZ_Click;
input_span.TextChanged += input_span_TextChanged;
input_gap.ValueChanged += input_gap_ValueChanged;
}
private void buttonSZ_Click(object sender, EventArgs e)
private void input_gap_ValueChanged(object sender, decimal value)
{
LoadGridPanel(input_span.Text, input_gap.Value);
}
private void input_span_TextChanged(object sender, EventArgs e)
{
LoadGridPanel(input_span.Text, input_gap.Value);
}

View File

@ -33,7 +33,6 @@
this.stackPanel15 = new AntdUI.StackPanel();
this.panel = new AntdUI.Panel();
this.buttonCZ = new AntdUI.Button();
this.buttonSZ = new AntdUI.Button();
this.stackPanel13 = new AntdUI.StackPanel();
this.input_shadowOH = new AntdUI.InputNumber();
this.label12 = new AntdUI.Label();
@ -124,7 +123,6 @@
//
this.stackPanel15.Controls.Add(this.panel);
this.stackPanel15.Controls.Add(this.buttonCZ);
this.stackPanel15.Controls.Add(this.buttonSZ);
this.stackPanel15.Controls.Add(this.stackPanel13);
this.stackPanel15.Controls.Add(this.stackPanel14);
this.stackPanel15.Location = new System.Drawing.Point(289, 3);
@ -136,8 +134,8 @@
//
// panel
//
this.panel.BackColor = System.Drawing.SystemColors.Control;
this.panel.Location = new System.Drawing.Point(3, 155);
this.panel.BackColor = System.Drawing.Color.Transparent;
this.panel.Location = new System.Drawing.Point(3, 117);
this.panel.Name = "panel";
this.panel.Shadow = 12;
this.panel.ShadowOpacityAnimation = true;
@ -148,7 +146,7 @@
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 117);
this.buttonCZ.Location = new System.Drawing.Point(3, 79);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(360, 32);
this.buttonCZ.TabIndex = 33;
@ -156,17 +154,6 @@
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
//
// buttonSZ
//
this.buttonSZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonSZ.Location = new System.Drawing.Point(3, 79);
this.buttonSZ.Name = "buttonSZ";
this.buttonSZ.Size = new System.Drawing.Size(360, 32);
this.buttonSZ.TabIndex = 32;
this.buttonSZ.Text = "设 置";
this.buttonSZ.Type = AntdUI.TTypeMini.Primary;
this.buttonSZ.WaveSize = 0;
//
// stackPanel13
//
this.stackPanel13.Controls.Add(this.input_shadowOH);
@ -680,7 +667,6 @@
private AntdUI.StackPanel stackPanel15;
private AntdUI.Panel panel;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonSZ;
private AntdUI.StackPanel stackPanel13;
private AntdUI.InputNumber input_shadowOH;
private AntdUI.Label label12;

View File

@ -1,5 +1,6 @@
using AntdUI;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace AntdUIDemo.Views
@ -13,19 +14,30 @@ namespace AntdUIDemo.Views
InitSelectItems();
// 设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
// 绑定事件
BindEventHandler();
}
private void BindButtonClick()
private void BindEventHandler()
{
buttonSZ.Click += buttonSZ_Click;
buttonCZ.Click += buttonCZ_Click;
}
private void PanelDemo_Load(object sender, EventArgs e)
{
LoadPanel();
select_arrowalign.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
select_shadowalign.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
select_shadowOA.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
input_arrowsize.ValueChanged += input_decimalvalue_ValueChanged;
input_radius.ValueChanged += input_decimalvalue_ValueChanged;
input_borderwidth.ValueChanged += input_decimalvalue_ValueChanged;
input_shadow.ValueChanged += input_decimalvalue_ValueChanged;
input_shadowX.ValueChanged += input_decimalvalue_ValueChanged;
input_shadowY.ValueChanged += input_decimalvalue_ValueChanged;
input_shadowO.ValueChanged += input_decimalvalue_ValueChanged;
input_shadowOH.ValueChanged += input_decimalvalue_ValueChanged;
colorPicker_border.ValueChanged += colorPicker_ValueChanged;
colorPicker_shadow.ValueChanged += colorPicker_ValueChanged;
}
private void InitSelectItems()
@ -57,28 +69,23 @@ namespace AntdUIDemo.Views
select_arrowalign.SelectedIndex = 0;
select_shadowalign.SelectedIndex = 0;
select_shadowOA.SelectedIndex = 0;
input_arrowsize.Value = 8;
input_radius.Value = 6;
input_shadow.Value = 12;
colorPicker_shadow.Value = Style.Db.TextBase;
colorPicker_border.Value = Style.Db.BorderColor;
input_borderwidth.Value = 0;
input_shadowX.Value = 0;
input_shadowY.Value = 0;
input_shadowO.Value = (decimal)0.2;
input_shadowOH.Value = (decimal)0.3;
}
// 设置
private void buttonSZ_Click(object sender, EventArgs e)
{
LoadPanel();
colorPicker_shadow.Value = Style.Db.TextBase;
colorPicker_border.Value = Style.Db.BorderColor;
}
private void LoadPanel()
{
panel.ArrowAlign = (TAlign)select_arrowalign.SelectedValue;
// TODO: 1.5.2版本 ArrowSize存在bug无法赋值更新,暂时使用panel.Invalidate();强制刷新,待更新后移除
panel.ArrowSize = (int)input_arrowsize.Value;
panel.Radius = (int)input_radius.Value;
panel.BorderWidth = (float)input_borderwidth.Value;
@ -91,8 +98,30 @@ namespace AntdUIDemo.Views
panel.ShadowOpacity = (float)input_shadowO.Value;
panel.ShadowOpacityAnimation = select_shadowOA.SelectedIndex == 0;
panel.ShadowOpacityHover = (float)input_shadowOH.Value;
panel.Invalidate();
}
#region
private void colorPicker_ValueChanged(object sender, Color value)
{
LoadPanel();
}
private void input_decimalvalue_ValueChanged(object sender, decimal value)
{
LoadPanel();
}
private void select_intvalue_SelectedIndexChanged(object sender, int value)
{
LoadPanel();
}
private void PanelDemo_Load(object sender, EventArgs e)
{
LoadPanel();
}
#endregion
}
}

View File

@ -29,35 +29,34 @@
private void InitializeComponent()
{
this.stackPanel1 = new AntdUI.StackPanel();
this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label();
this.divider1 = new AntdUI.Divider();
this.stackPanel2 = new AntdUI.StackPanel();
this.stackPanel3 = new AntdUI.StackPanel();
this.stackPanel = new AntdUI.StackPanel();
this.stackPanel6 = new AntdUI.StackPanel();
this.select_autoscroll = new AntdUI.Select();
this.label4 = new AntdUI.Label();
this.stackPanel5 = new AntdUI.StackPanel();
this.input_gap = new AntdUI.InputNumber();
this.label3 = new AntdUI.Label();
this.stackPanel7 = new AntdUI.StackPanel();
this.label5 = new AntdUI.Label();
this.stackPanel3 = new AntdUI.StackPanel();
this.buttonDEL = new AntdUI.Button();
this.buttonADD = new AntdUI.Button();
this.stackPanel8 = new AntdUI.StackPanel();
this.select_vertical = new AntdUI.Select();
this.label6 = new AntdUI.Label();
this.buttonCZ = new AntdUI.Button();
this.buttonSZ = new AntdUI.Button();
this.buttonDEL = new AntdUI.Button();
this.buttonADD = new AntdUI.Button();
this.stackPanel7 = new AntdUI.StackPanel();
this.input_itemsize = new AntdUI.Input();
this.label5 = new AntdUI.Label();
this.stackPanel5 = new AntdUI.StackPanel();
this.input_gap = new AntdUI.InputNumber();
this.label3 = new AntdUI.Label();
this.stackPanel6 = new AntdUI.StackPanel();
this.select_autoscroll = new AntdUI.Select();
this.label4 = new AntdUI.Label();
this.divider1 = new AntdUI.Divider();
this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label();
this.buttonCZ = new AntdUI.Button();
this.stackPanel1.SuspendLayout();
this.stackPanel2.SuspendLayout();
this.stackPanel3.SuspendLayout();
this.stackPanel6.SuspendLayout();
this.stackPanel5.SuspendLayout();
this.stackPanel7.SuspendLayout();
this.stackPanel8.SuspendLayout();
this.stackPanel7.SuspendLayout();
this.stackPanel5.SuspendLayout();
this.stackPanel6.SuspendLayout();
this.SuspendLayout();
//
// stackPanel1
@ -74,31 +73,6 @@
this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true;
//
// 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 = 9;
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 = 8;
this.label1.Text = "StackPanel 堆叠布局";
//
// 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 = 10;
//
// stackPanel2
//
this.stackPanel2.Controls.Add(this.stackPanel);
@ -109,12 +83,20 @@
this.stackPanel2.TabIndex = 11;
this.stackPanel2.Text = "stackPanel2";
//
// stackPanel
//
this.stackPanel.ItemSize = "";
this.stackPanel.Location = new System.Drawing.Point(289, 3);
this.stackPanel.Name = "stackPanel";
this.stackPanel.Size = new System.Drawing.Size(400, 400);
this.stackPanel.TabIndex = 1;
this.stackPanel.Vertical = true;
//
// stackPanel3
//
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonDEL);
this.stackPanel3.Controls.Add(this.buttonADD);
this.stackPanel3.Controls.Add(this.buttonCZ);
this.stackPanel3.Controls.Add(this.buttonSZ);
this.stackPanel3.Controls.Add(this.stackPanel8);
this.stackPanel3.Controls.Add(this.stackPanel7);
this.stackPanel3.Controls.Add(this.stackPanel5);
@ -126,98 +108,27 @@
this.stackPanel3.Text = "stackPanel3";
this.stackPanel3.Vertical = true;
//
// stackPanel
// buttonDEL
//
this.stackPanel.BackColor = System.Drawing.Color.White;
this.stackPanel.ItemSize = "";
this.stackPanel.Location = new System.Drawing.Point(289, 3);
this.stackPanel.Name = "stackPanel";
this.stackPanel.Size = new System.Drawing.Size(400, 400);
this.stackPanel.TabIndex = 1;
this.stackPanel.Vertical = true;
this.buttonDEL.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonDEL.Location = new System.Drawing.Point(3, 193);
this.buttonDEL.Name = "buttonDEL";
this.buttonDEL.Size = new System.Drawing.Size(274, 32);
this.buttonDEL.TabIndex = 38;
this.buttonDEL.Text = "删除 Button";
this.buttonDEL.Type = AntdUI.TTypeMini.Error;
this.buttonDEL.WaveSize = 0;
//
// stackPanel6
// buttonADD
//
this.stackPanel6.Controls.Add(this.select_autoscroll);
this.stackPanel6.Controls.Add(this.label4);
this.stackPanel6.Location = new System.Drawing.Point(3, 3);
this.stackPanel6.Name = "stackPanel6";
this.stackPanel6.Size = new System.Drawing.Size(274, 32);
this.stackPanel6.TabIndex = 12;
this.stackPanel6.Text = "stackPanel6";
//
// select_autoscroll
//
this.select_autoscroll.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.select_autoscroll.Items.AddRange(new object[] {
"True",
"False"});
this.select_autoscroll.List = true;
this.select_autoscroll.Location = new System.Drawing.Point(97, 3);
this.select_autoscroll.Name = "select_autoscroll";
this.select_autoscroll.SelectedIndex = 1;
this.select_autoscroll.SelectedValue = "False";
this.select_autoscroll.Size = new System.Drawing.Size(175, 26);
this.select_autoscroll.TabIndex = 11;
this.select_autoscroll.Text = "False";
this.select_autoscroll.WaveSize = 1;
//
// 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, 3);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(88, 26);
this.label4.TabIndex = 4;
this.label4.Text = "AutoScroll";
//
// stackPanel5
//
this.stackPanel5.Controls.Add(this.input_gap);
this.stackPanel5.Controls.Add(this.label3);
this.stackPanel5.Location = new System.Drawing.Point(3, 41);
this.stackPanel5.Name = "stackPanel5";
this.stackPanel5.Size = new System.Drawing.Size(274, 32);
this.stackPanel5.TabIndex = 19;
this.stackPanel5.Text = "stackPanel5";
//
// input_gap
//
this.input_gap.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.input_gap.Location = new System.Drawing.Point(97, 3);
this.input_gap.Name = "input_gap";
this.input_gap.Size = new System.Drawing.Size(175, 26);
this.input_gap.TabIndex = 5;
this.input_gap.Text = "0";
this.input_gap.WaveSize = 1;
//
// 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, 3);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(88, 26);
this.label3.TabIndex = 4;
this.label3.Text = "Gap";
//
// stackPanel7
//
this.stackPanel7.Controls.Add(this.input_itemsize);
this.stackPanel7.Controls.Add(this.label5);
this.stackPanel7.Location = new System.Drawing.Point(3, 79);
this.stackPanel7.Name = "stackPanel7";
this.stackPanel7.Size = new System.Drawing.Size(274, 32);
this.stackPanel7.TabIndex = 20;
this.stackPanel7.Text = "stackPanel7";
//
// 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, 3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 26);
this.label5.TabIndex = 4;
this.label5.Text = "ItemSize";
this.buttonADD.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonADD.Location = new System.Drawing.Point(3, 155);
this.buttonADD.Name = "buttonADD";
this.buttonADD.Size = new System.Drawing.Size(274, 32);
this.buttonADD.TabIndex = 37;
this.buttonADD.Text = "添加 Button";
this.buttonADD.Type = AntdUI.TTypeMini.Info;
this.buttonADD.WaveSize = 0;
//
// stackPanel8
//
@ -254,49 +165,15 @@
this.label6.TabIndex = 4;
this.label6.Text = "Vertical";
//
// buttonCZ
// stackPanel7
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 193);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 35;
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
//
// buttonSZ
//
this.buttonSZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonSZ.Location = new System.Drawing.Point(3, 155);
this.buttonSZ.Name = "buttonSZ";
this.buttonSZ.Size = new System.Drawing.Size(274, 32);
this.buttonSZ.TabIndex = 34;
this.buttonSZ.Text = "设 置";
this.buttonSZ.Type = AntdUI.TTypeMini.Primary;
this.buttonSZ.WaveSize = 0;
//
// buttonDEL
//
this.buttonDEL.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonDEL.Location = new System.Drawing.Point(3, 269);
this.buttonDEL.Name = "buttonDEL";
this.buttonDEL.Size = new System.Drawing.Size(274, 32);
this.buttonDEL.TabIndex = 38;
this.buttonDEL.Text = "删除 Button";
this.buttonDEL.Type = AntdUI.TTypeMini.Error;
this.buttonDEL.WaveSize = 0;
//
// buttonADD
//
this.buttonADD.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonADD.Location = new System.Drawing.Point(3, 231);
this.buttonADD.Name = "buttonADD";
this.buttonADD.Size = new System.Drawing.Size(274, 32);
this.buttonADD.TabIndex = 37;
this.buttonADD.Text = "添加 Button";
this.buttonADD.Type = AntdUI.TTypeMini.Info;
this.buttonADD.WaveSize = 0;
this.stackPanel7.Controls.Add(this.input_itemsize);
this.stackPanel7.Controls.Add(this.label5);
this.stackPanel7.Location = new System.Drawing.Point(3, 79);
this.stackPanel7.Name = "stackPanel7";
this.stackPanel7.Size = new System.Drawing.Size(274, 32);
this.stackPanel7.TabIndex = 20;
this.stackPanel7.Text = "stackPanel7";
//
// input_itemsize
//
@ -308,6 +185,115 @@
this.input_itemsize.TabIndex = 5;
this.input_itemsize.WaveSize = 0;
//
// 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, 3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 26);
this.label5.TabIndex = 4;
this.label5.Text = "ItemSize";
//
// stackPanel5
//
this.stackPanel5.Controls.Add(this.input_gap);
this.stackPanel5.Controls.Add(this.label3);
this.stackPanel5.Location = new System.Drawing.Point(3, 41);
this.stackPanel5.Name = "stackPanel5";
this.stackPanel5.Size = new System.Drawing.Size(274, 32);
this.stackPanel5.TabIndex = 19;
this.stackPanel5.Text = "stackPanel5";
//
// input_gap
//
this.input_gap.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.input_gap.Location = new System.Drawing.Point(97, 3);
this.input_gap.Name = "input_gap";
this.input_gap.Size = new System.Drawing.Size(175, 26);
this.input_gap.TabIndex = 5;
this.input_gap.Text = "0";
this.input_gap.WaveSize = 1;
//
// 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, 3);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(88, 26);
this.label3.TabIndex = 4;
this.label3.Text = "Gap";
//
// stackPanel6
//
this.stackPanel6.Controls.Add(this.select_autoscroll);
this.stackPanel6.Controls.Add(this.label4);
this.stackPanel6.Location = new System.Drawing.Point(3, 3);
this.stackPanel6.Name = "stackPanel6";
this.stackPanel6.Size = new System.Drawing.Size(274, 32);
this.stackPanel6.TabIndex = 12;
this.stackPanel6.Text = "stackPanel6";
//
// select_autoscroll
//
this.select_autoscroll.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.select_autoscroll.Items.AddRange(new object[] {
"True",
"False"});
this.select_autoscroll.List = true;
this.select_autoscroll.Location = new System.Drawing.Point(97, 3);
this.select_autoscroll.Name = "select_autoscroll";
this.select_autoscroll.SelectedIndex = 1;
this.select_autoscroll.SelectedValue = "False";
this.select_autoscroll.Size = new System.Drawing.Size(175, 26);
this.select_autoscroll.TabIndex = 11;
this.select_autoscroll.Text = "False";
this.select_autoscroll.WaveSize = 1;
//
// 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, 3);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(88, 26);
this.label4.TabIndex = 4;
this.label4.Text = "AutoScroll";
//
// 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 = 10;
//
// 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 = 9;
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 = 8;
this.label1.Text = "StackPanel 堆叠布局";
//
// buttonCZ
//
this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.buttonCZ.Location = new System.Drawing.Point(3, 231);
this.buttonCZ.Name = "buttonCZ";
this.buttonCZ.Size = new System.Drawing.Size(274, 32);
this.buttonCZ.TabIndex = 39;
this.buttonCZ.Text = "重 置";
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
this.buttonCZ.WaveSize = 0;
//
// StackPanelDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
@ -318,10 +304,10 @@
this.stackPanel1.ResumeLayout(false);
this.stackPanel2.ResumeLayout(false);
this.stackPanel3.ResumeLayout(false);
this.stackPanel6.ResumeLayout(false);
this.stackPanel5.ResumeLayout(false);
this.stackPanel7.ResumeLayout(false);
this.stackPanel8.ResumeLayout(false);
this.stackPanel7.ResumeLayout(false);
this.stackPanel5.ResumeLayout(false);
this.stackPanel6.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -346,10 +332,9 @@
private AntdUI.Label label6;
private AntdUI.StackPanel stackPanel7;
private AntdUI.Label label5;
private AntdUI.Button buttonCZ;
private AntdUI.Button buttonSZ;
private AntdUI.Button buttonDEL;
private AntdUI.Button buttonADD;
private AntdUI.Input input_itemsize;
private AntdUI.Button buttonCZ;
}
}

View File

@ -18,8 +18,8 @@ namespace AntdUIDemo.Views
InitializeComponent();
//设置默认值
InitData();
// 绑定按钮事件
BindButtonClick();
// 绑定事件
BindEventHandler();
}
private void StackPanelDemo_Load(object sender, EventArgs e)
@ -47,12 +47,44 @@ namespace AntdUIDemo.Views
}
}
private void BindButtonClick()
private void BindEventHandler()
{
buttonSZ.Click += ButtonSZ_Click;
buttonCZ.Click += ButtonCZ_Click;
buttonADD.Click += ButtonADD_Click;
buttonDEL.Click += ButtonDEL_Click;
select_autoscroll.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
select_vertical.SelectedIndexChanged += select_intvalue_SelectedIndexChanged;
input_gap.ValueChanged += input_gap_ValueChanged;
input_itemsize.TextChanged += input_itemsize_TextChanged;
}
private void InitData()
{
select_autoscroll.SelectedIndex = 1;
input_gap.Value = 0;
input_itemsize.Text = "10%";
select_vertical.SelectedIndex = 0;
}
#region
private void input_itemsize_TextChanged(object sender, EventArgs e)
{
stackPanel.ItemSize = input_itemsize.Text;
}
private void input_gap_ValueChanged(object sender, decimal value)
{
stackPanel.Gap = (int)input_gap.Value;
}
private void select_intvalue_SelectedIndexChanged(object sender, int value)
{
stackPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
stackPanel.Vertical = select_vertical.SelectedIndex == 0;
}
private void ButtonDEL_Click(object sender, EventArgs e)
@ -81,22 +113,7 @@ namespace AntdUIDemo.Views
InitData();
LoadStackPanel();
}
private void ButtonSZ_Click(object sender, EventArgs e)
{
stackPanel.AutoScroll = select_autoscroll.SelectedIndex == 0;
stackPanel.Gap = (int)input_gap.Value;
stackPanel.ItemSize = input_itemsize.Text;
stackPanel.Vertical = select_vertical.SelectedIndex == 0;
}
private void InitData()
{
select_autoscroll.SelectedIndex = 1;
input_gap.Value = 0;
input_itemsize.Text = "10%";
select_vertical.SelectedIndex = 0;
}
#endregion
}
}