diff --git a/AntdUIDemo.csproj b/AntdUIDemo.csproj index 94f2286..e6ad0e2 100644 --- a/AntdUIDemo.csproj +++ b/AntdUIDemo.csproj @@ -13,7 +13,7 @@ Copyright © 2024 czz_y $(Version) $(Version) - 1.7.1 + 1.7.4 czz_y 基于 Winform UI 框架 AntdUI 设计的 Demo https://gitee.com/mubaiyanghua/antd-uidemo @@ -30,7 +30,7 @@ - + diff --git a/MainWindow.cs b/MainWindow.cs index 9757397..07b799a 100644 --- a/MainWindow.cs +++ b/MainWindow.cs @@ -275,11 +275,14 @@ namespace AntdUIDemo control = new CarouselDemo(); break; case "Collapse": - control = new CollapseDemo(); + control = new CollapseDemo(this); break; case "Label": control = new LabelDemo(); break; + case "LabelTime": + control = new LabelTimeDemo(); + break; case "Popover": control = new PopoverDemo(this); break; diff --git a/Models/DataUtil.cs b/Models/DataUtil.cs index c2e6445..d65524a 100644 --- a/Models/DataUtil.cs +++ b/Models/DataUtil.cs @@ -59,6 +59,7 @@ namespace AntdUIDemo.Models new MenuItems { Text = "Carousel 走马灯", Tag = "Carousel"}, new MenuItems { Text = "Collapse 折叠面板", Tag = "Collapse"}, new MenuItems { Text = "Label 标签", Tag = "Label"}, + new MenuItems { Text = "LabelTime 时间标签", Tag = "LabelTime"}, new MenuItems { Text = "Popover 气泡卡片", Tag = "Popover"}, new MenuItems { Text = "Preview 图片预览", Tag = "Preview"}, new MenuItems { Text = "Segmented 分段控制器", Tag = "Segmented"}, diff --git a/Models/User.cs b/Models/User.cs index f66718c..789392d 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -16,6 +16,8 @@ namespace AntdUIDemo.Models private CellLink[] cellLinks; private CellProgress cellProgress; private CellDivider cellDivider; + //用于设置树形表格,加入自身数组 + private User[] users; public bool Selected { @@ -149,5 +151,16 @@ namespace AntdUIDemo.Models } } + public User[] Users + { + get { return users; } + set + { + if (users == value) return; + users = value; + OnPropertyChanged(nameof(Users)); + } + + } } } diff --git a/README.md b/README.md index 76a421d..c2e2942 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

AntdUI Demo

-本项目基于 `Winform .NET Framework 4.8` 开发,是 [AntdUI](https://gitee.com/antdui/AntdUI) 的 Demo 项目,当前版本 `1.7.1` +本项目基于 `Winform .NET Framework 4.8` 开发,是 [AntdUI](https://gitee.com/antdui/AntdUI) 的 Demo 项目,当前版本 `1.7.4` diff --git a/Views/CollapseDemo.cs b/Views/CollapseDemo.cs index 9a13d2b..fd5b00b 100644 --- a/Views/CollapseDemo.cs +++ b/Views/CollapseDemo.cs @@ -1,12 +1,28 @@ -using System.Windows.Forms; +using System; +using System.Windows.Forms; namespace AntdUIDemo.Views { public partial class CollapseDemo : UserControl { - public CollapseDemo() + private AntdUI.Window window; + public CollapseDemo(AntdUI.Window _window) { + window = _window; InitializeComponent(); + BindEventHandler(); + } + + private void BindEventHandler() + { + collapse1.ExpandChanged += Collapse_ExpandChanged; + } + + private void Collapse_ExpandChanged(object sender, AntdUI.CollapseExpandEventArgs e) + { + //关闭和打开都会触发 + string str = e.Expand ? "open" : "close"; + AntdUI.Notification.info(window, str, e.Value.ToString(),autoClose:3); } } } diff --git a/Views/ColorPickerDemo.Designer.cs b/Views/ColorPickerDemo.Designer.cs index d332d96..49b4ebd 100644 --- a/Views/ColorPickerDemo.Designer.cs +++ b/Views/ColorPickerDemo.Designer.cs @@ -54,11 +54,16 @@ this.colorPicker2 = new AntdUI.ColorPicker(); this.colorPicker1 = new AntdUI.ColorPicker(); this.label3 = new AntdUI.Label(); + this.label1 = new AntdUI.Label(); + this.flowPanel5 = new AntdUI.FlowPanel(); + this.colorPicker20 = new AntdUI.ColorPicker(); + this.colorPicker17 = new AntdUI.ColorPicker(); this.stackPanel1.SuspendLayout(); this.flowPanel4.SuspendLayout(); this.flowPanel3.SuspendLayout(); this.flowPanel2.SuspendLayout(); this.flowPanel1.SuspendLayout(); + this.flowPanel5.SuspendLayout(); this.SuspendLayout(); // // header1 @@ -77,6 +82,8 @@ // // stackPanel1 // + this.stackPanel1.Controls.Add(this.flowPanel5); + this.stackPanel1.Controls.Add(this.label1); this.stackPanel1.Controls.Add(this.flowPanel4); this.stackPanel1.Controls.Add(this.label6); this.stackPanel1.Controls.Add(this.flowPanel3); @@ -88,7 +95,7 @@ this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.stackPanel1.Location = new System.Drawing.Point(0, 74); this.stackPanel1.Name = "stackPanel1"; - this.stackPanel1.Size = new System.Drawing.Size(750, 361); + this.stackPanel1.Size = new System.Drawing.Size(750, 421); this.stackPanel1.TabIndex = 0; this.stackPanel1.Text = "stackPanel1"; this.stackPanel1.Vertical = true; @@ -381,18 +388,61 @@ this.label3.TabIndex = 8; this.label3.Text = "文字显示"; // + // label1 + // + this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(3, 299); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(744, 24); + this.label1.TabIndex = 16; + this.label1.Text = "清除选择"; + // + // flowPanel5 + // + this.flowPanel5.Controls.Add(this.colorPicker17); + this.flowPanel5.Controls.Add(this.colorPicker20); + this.flowPanel5.Location = new System.Drawing.Point(3, 329); + this.flowPanel5.Name = "flowPanel5"; + this.flowPanel5.Size = new System.Drawing.Size(744, 38); + this.flowPanel5.TabIndex = 17; + this.flowPanel5.Text = "flowPanel5"; + // + // colorPicker20 + // + this.colorPicker20.AllowClear = true; + this.colorPicker20.Location = new System.Drawing.Point(3, 3); + this.colorPicker20.Name = "colorPicker20"; + this.colorPicker20.Size = new System.Drawing.Size(32, 32); + this.colorPicker20.TabIndex = 0; + this.colorPicker20.Text = "colorPicker20"; + this.colorPicker20.Value = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(119)))), ((int)(((byte)(255))))); + this.colorPicker20.WaveSize = 0; + // + // colorPicker17 + // + this.colorPicker17.AllowClear = true; + this.colorPicker17.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.colorPicker17.Location = new System.Drawing.Point(41, 3); + this.colorPicker17.Name = "colorPicker17"; + this.colorPicker17.ShowText = true; + this.colorPicker17.Size = new System.Drawing.Size(105, 32); + this.colorPicker17.TabIndex = 4; + this.colorPicker17.Text = "colorPicker17"; + this.colorPicker17.Value = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(119)))), ((int)(((byte)(255))))); + this.colorPicker17.WaveSize = 0; + // // ColorPickerDemo // - this.Controls.Add(this.stackPanel1); this.Controls.Add(this.header1); this.Name = "ColorPickerDemo"; - this.Size = new System.Drawing.Size(750, 435); + this.Size = new System.Drawing.Size(750, 495); this.stackPanel1.ResumeLayout(false); this.flowPanel4.ResumeLayout(false); this.flowPanel3.ResumeLayout(false); this.flowPanel2.ResumeLayout(false); this.flowPanel1.ResumeLayout(false); + this.flowPanel5.ResumeLayout(false); this.ResumeLayout(false); } @@ -425,5 +475,9 @@ private AntdUI.ColorPicker colorPicker16; private AntdUI.ColorPicker colorPicker14; private AntdUI.ColorPicker colorPicker12; + private AntdUI.FlowPanel flowPanel5; + private AntdUI.ColorPicker colorPicker20; + private AntdUI.Label label1; + private AntdUI.ColorPicker colorPicker17; } } diff --git a/Views/FloatButtonDemo.Designer.cs b/Views/FloatButtonDemo.Designer.cs index 20e0bb0..a220bcb 100644 --- a/Views/FloatButtonDemo.Designer.cs +++ b/Views/FloatButtonDemo.Designer.cs @@ -30,12 +30,7 @@ { this.header1 = new AntdUI.PageHeader(); this.stackPanel1 = new AntdUI.StackPanel(); - this.stackPanel2 = new AntdUI.StackPanel(); - this.buttonCZ = new AntdUI.Button(); - this.buttonClose = new AntdUI.Button(); this.stackPanel6 = new AntdUI.StackPanel(); - this.colorPicker = new AntdUI.ColorPicker(); - this.label16 = new AntdUI.Label(); this.input_badgesize = new AntdUI.InputNumber(); this.label15 = new AntdUI.Label(); this.input_badge = new AntdUI.Input(); @@ -67,13 +62,24 @@ this.label10 = new AntdUI.Label(); this.label4 = new AntdUI.Label(); this.label3 = new AntdUI.Label(); + this.stackPanel8 = new AntdUI.StackPanel(); + this.stackPanel2 = new AntdUI.StackPanel(); + this.buttonCZ = new AntdUI.Button(); + this.buttonClose = new AntdUI.Button(); + this.colorPicker = new AntdUI.ColorPicker(); + this.label16 = new AntdUI.Label(); + this.switch_loading = new AntdUI.Switch(); + this.label2 = new AntdUI.Label(); + this.switch_enabled = new AntdUI.Switch(); + this.label18 = new AntdUI.Label(); this.stackPanel1.SuspendLayout(); - this.stackPanel2.SuspendLayout(); this.stackPanel6.SuspendLayout(); this.stackPanel5.SuspendLayout(); this.stackPanel7.SuspendLayout(); this.stackPanel4.SuspendLayout(); this.stackPanel3.SuspendLayout(); + this.stackPanel8.SuspendLayout(); + this.stackPanel2.SuspendLayout(); this.SuspendLayout(); // // header1 @@ -93,6 +99,7 @@ // stackPanel1 // this.stackPanel1.Controls.Add(this.stackPanel2); + this.stackPanel1.Controls.Add(this.stackPanel8); this.stackPanel1.Controls.Add(this.stackPanel6); this.stackPanel1.Controls.Add(this.stackPanel5); this.stackPanel1.Controls.Add(this.label11); @@ -103,47 +110,15 @@ this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.stackPanel1.Location = new System.Drawing.Point(0, 104); this.stackPanel1.Name = "stackPanel1"; - this.stackPanel1.Size = new System.Drawing.Size(750, 330); + this.stackPanel1.Size = new System.Drawing.Size(750, 388); this.stackPanel1.TabIndex = 0; this.stackPanel1.Text = "stackPanel1"; this.stackPanel1.Vertical = true; // - // stackPanel2 - // - this.stackPanel2.Controls.Add(this.buttonCZ); - this.stackPanel2.Controls.Add(this.buttonClose); - this.stackPanel2.Location = new System.Drawing.Point(3, 253); - this.stackPanel2.Name = "stackPanel2"; - this.stackPanel2.Size = new System.Drawing.Size(744, 38); - this.stackPanel2.TabIndex = 26; - this.stackPanel2.Text = "stackPanel2"; - // - // 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(84, 3); - this.buttonCZ.Name = "buttonCZ"; - this.buttonCZ.Size = new System.Drawing.Size(75, 32); - this.buttonCZ.TabIndex = 4; - this.buttonCZ.Text = "重 置"; - this.buttonCZ.Type = AntdUI.TTypeMini.Warn; - this.buttonCZ.WaveSize = 0; - // - // 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(3, 3); - this.buttonClose.Name = "buttonClose"; - this.buttonClose.Size = new System.Drawing.Size(75, 32); - this.buttonClose.TabIndex = 3; - this.buttonClose.Text = "关 闭"; - this.buttonClose.Type = AntdUI.TTypeMini.Error; - this.buttonClose.WaveSize = 0; - // // stackPanel6 // - this.stackPanel6.Controls.Add(this.colorPicker); - this.stackPanel6.Controls.Add(this.label16); + this.stackPanel6.Controls.Add(this.switch_loading); + this.stackPanel6.Controls.Add(this.label2); this.stackPanel6.Controls.Add(this.input_badgesize); this.stackPanel6.Controls.Add(this.label15); this.stackPanel6.Controls.Add(this.input_badge); @@ -155,27 +130,6 @@ this.stackPanel6.TabIndex = 25; this.stackPanel6.Text = "stackPanel6"; // - // colorPicker - // - this.colorPicker.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); - this.colorPicker.Location = new System.Drawing.Point(492, 3); - this.colorPicker.Name = "colorPicker"; - this.colorPicker.ShowText = true; - this.colorPicker.Size = new System.Drawing.Size(100, 26); - this.colorPicker.TabIndex = 15; - this.colorPicker.Text = "colorPicker1"; - this.colorPicker.Value = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(119)))), ((int)(((byte)(255))))); - this.colorPicker.WaveSize = 0; - // - // label16 - // - this.label16.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label16.Location = new System.Drawing.Point(390, 3); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(92, 26); - this.label16.TabIndex = 14; - this.label16.Text = "BadgeBack"; - // // input_badgesize // this.input_badgesize.DecimalPlaces = 2; @@ -548,21 +502,124 @@ this.label3.TabIndex = 4; this.label3.Text = "FloatButton没有工具箱控件,使用代码方式调用。"; // + // stackPanel8 + // + this.stackPanel8.Controls.Add(this.switch_enabled); + this.stackPanel8.Controls.Add(this.label18); + this.stackPanel8.Controls.Add(this.colorPicker); + this.stackPanel8.Controls.Add(this.label16); + this.stackPanel8.Gap = 4; + this.stackPanel8.Location = new System.Drawing.Point(3, 253); + this.stackPanel8.Name = "stackPanel8"; + this.stackPanel8.Size = new System.Drawing.Size(744, 32); + this.stackPanel8.TabIndex = 27; + this.stackPanel8.Text = "stackPanel8"; + // + // stackPanel2 + // + this.stackPanel2.Controls.Add(this.buttonCZ); + this.stackPanel2.Controls.Add(this.buttonClose); + this.stackPanel2.Location = new System.Drawing.Point(3, 291); + this.stackPanel2.Name = "stackPanel2"; + this.stackPanel2.Size = new System.Drawing.Size(744, 38); + this.stackPanel2.TabIndex = 28; + this.stackPanel2.Text = "stackPanel2"; + // + // 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(84, 3); + this.buttonCZ.Name = "buttonCZ"; + this.buttonCZ.Size = new System.Drawing.Size(75, 32); + this.buttonCZ.TabIndex = 4; + this.buttonCZ.Text = "重 置"; + this.buttonCZ.Type = AntdUI.TTypeMini.Warn; + this.buttonCZ.WaveSize = 0; + // + // 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(3, 3); + this.buttonClose.Name = "buttonClose"; + this.buttonClose.Size = new System.Drawing.Size(75, 32); + this.buttonClose.TabIndex = 3; + this.buttonClose.Text = "关 闭"; + this.buttonClose.Type = AntdUI.TTypeMini.Error; + this.buttonClose.WaveSize = 0; + // + // colorPicker + // + this.colorPicker.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.colorPicker.Location = new System.Drawing.Point(105, 3); + this.colorPicker.Name = "colorPicker"; + this.colorPicker.ShowText = true; + this.colorPicker.Size = new System.Drawing.Size(75, 26); + this.colorPicker.TabIndex = 30; + this.colorPicker.Text = "colorPicker1"; + this.colorPicker.Value = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(119)))), ((int)(((byte)(255))))); + this.colorPicker.WaveSize = 0; + // + // label16 + // + this.label16.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label16.Location = new System.Drawing.Point(3, 3); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(92, 26); + this.label16.TabIndex = 29; + this.label16.Text = "BadgeBack"; + // + // switch_loading + // + this.switch_loading.AutoCheck = true; + this.switch_loading.Location = new System.Drawing.Point(492, 3); + this.switch_loading.Name = "switch_loading"; + this.switch_loading.Size = new System.Drawing.Size(50, 26); + this.switch_loading.TabIndex = 30; + this.switch_loading.Text = "switch1"; + // + // 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(390, 3); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(92, 26); + this.label2.TabIndex = 29; + this.label2.Text = "Loading"; + // + // switch_enabled + // + this.switch_enabled.AutoCheck = true; + this.switch_enabled.Location = new System.Drawing.Point(292, 3); + this.switch_enabled.Name = "switch_enabled"; + this.switch_enabled.Size = new System.Drawing.Size(50, 26); + this.switch_enabled.TabIndex = 32; + this.switch_enabled.Text = "switch1"; + // + // label18 + // + this.label18.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label18.Location = new System.Drawing.Point(190, 3); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(92, 26); + this.label18.TabIndex = 31; + this.label18.Text = "Enabled"; + // // FloatButtonDemo // this.Controls.Add(this.stackPanel1); this.Controls.Add(this.label3); this.Controls.Add(this.header1); this.Name = "FloatButtonDemo"; - this.Size = new System.Drawing.Size(750, 434); + this.Size = new System.Drawing.Size(750, 492); this.Load += new System.EventHandler(this.FloatButtonDemo_Load); this.stackPanel1.ResumeLayout(false); - this.stackPanel2.ResumeLayout(false); this.stackPanel6.ResumeLayout(false); this.stackPanel5.ResumeLayout(false); this.stackPanel7.ResumeLayout(false); this.stackPanel4.ResumeLayout(false); this.stackPanel3.ResumeLayout(false); + this.stackPanel8.ResumeLayout(false); + this.stackPanel2.ResumeLayout(false); this.ResumeLayout(false); } @@ -581,12 +638,7 @@ private AntdUI.Select select_align; private AntdUI.Label label10; private AntdUI.Label label4; - private AntdUI.StackPanel stackPanel2; - private AntdUI.Button buttonCZ; - private AntdUI.Button buttonClose; private AntdUI.StackPanel stackPanel6; - private AntdUI.ColorPicker colorPicker; - private AntdUI.Label label16; private AntdUI.InputNumber input_badgesize; private AntdUI.Label label15; private AntdUI.Input input_badge; @@ -608,5 +660,15 @@ private AntdUI.Label label14; private AntdUI.Select select_type; private AntdUI.Label label13; + private AntdUI.StackPanel stackPanel2; + private AntdUI.Button buttonCZ; + private AntdUI.Button buttonClose; + private AntdUI.StackPanel stackPanel8; + private AntdUI.Switch switch_enabled; + private AntdUI.Label label18; + private AntdUI.ColorPicker colorPicker; + private AntdUI.Label label16; + private AntdUI.Switch switch_loading; + private AntdUI.Label label2; } } diff --git a/Views/FloatButtonDemo.cs b/Views/FloatButtonDemo.cs index 5d2dbbb..5375ddc 100644 --- a/Views/FloatButtonDemo.cs +++ b/Views/FloatButtonDemo.cs @@ -77,6 +77,8 @@ namespace AntdUIDemo.Views switch_round.Checked = false; switch_vertical.Checked = true; switch_topmost.Checked = false; + switch_enabled.Checked = false; + switch_loading.Checked = false; input_size.Value = 40; input_mx.Value = 24; @@ -109,6 +111,8 @@ namespace AntdUIDemo.Views Badge = input_badge.Text, BadgeSize = (float)input_badgesize.Value, BadgeBack = colorPicker.Value, + Enabled = switch_enabled.Checked, + }, // 使用资源图片 new FloatButton.ConfigBtn("button2", Properties.Resources.关闭) @@ -121,6 +125,8 @@ namespace AntdUIDemo.Views Badge = input_badge.Text, BadgeSize = (float)input_badgesize.Value, BadgeBack = colorPicker.Value, + Enabled = switch_enabled.Checked, + Loading = switch_loading.Checked, }, // 使用文本 new FloatButton.ConfigBtn("button3", "文本") @@ -132,6 +138,8 @@ namespace AntdUIDemo.Views Badge = input_badge.Text, BadgeSize = (float)input_badgesize.Value, BadgeBack = colorPicker.Value, + Enabled = switch_enabled.Checked, + Loading = switch_loading.Checked, }, //获取button示例,可以通过button的属性判断点击了哪个按钮,推荐用Name }, button => diff --git a/Views/LabelDemo.Designer.cs b/Views/LabelDemo.Designer.cs index 1f32ee5..3df7897 100644 --- a/Views/LabelDemo.Designer.cs +++ b/Views/LabelDemo.Designer.cs @@ -40,13 +40,19 @@ this.label4 = new AntdUI.Label(); this.label3 = new AntdUI.Label(); this.header1 = new AntdUI.PageHeader(); + this.label1 = new AntdUI.Label(); + this.flowPanel3 = new AntdUI.FlowPanel(); + this.label8 = new AntdUI.Label(); this.stackPanel1.SuspendLayout(); this.flowPanel2.SuspendLayout(); this.flowPanel1.SuspendLayout(); + this.flowPanel3.SuspendLayout(); this.SuspendLayout(); // // stackPanel1 // + this.stackPanel1.Controls.Add(this.flowPanel3); + this.stackPanel1.Controls.Add(this.label1); this.stackPanel1.Controls.Add(this.flowPanel2); this.stackPanel1.Controls.Add(this.label9); this.stackPanel1.Controls.Add(this.flowPanel1); @@ -178,6 +184,36 @@ this.header1.Text = "Label 标签"; this.header1.UseTitleFont = true; // + // label1 + // + this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(3, 151); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(744, 24); + this.label1.TabIndex = 33; + this.label1.Text = "文字渐变"; + // + // flowPanel3 + // + this.flowPanel3.Controls.Add(this.label8); + this.flowPanel3.Gap = 6; + this.flowPanel3.Location = new System.Drawing.Point(3, 181); + this.flowPanel3.Name = "flowPanel3"; + this.flowPanel3.Size = new System.Drawing.Size(744, 38); + this.flowPanel3.TabIndex = 34; + this.flowPanel3.Text = "flowPanel3"; + // + // label8 + // + this.label8.ColorExtend = "135,#FF0000,#00FF00"; + this.label8.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label8.Location = new System.Drawing.Point(3, 3); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(120, 32); + this.label8.TabIndex = 0; + this.label8.Text = "渐变标签"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // LabelDemo // this.Controls.Add(this.stackPanel1); @@ -187,6 +223,7 @@ this.stackPanel1.ResumeLayout(false); this.flowPanel2.ResumeLayout(false); this.flowPanel1.ResumeLayout(false); + this.flowPanel3.ResumeLayout(false); this.ResumeLayout(false); } @@ -204,5 +241,8 @@ private AntdUI.Label label10; private AntdUI.Label label11; private AntdUI.PageHeader header1; + private AntdUI.FlowPanel flowPanel3; + private AntdUI.Label label8; + private AntdUI.Label label1; } } diff --git a/Views/LabelTimeDemo.Designer.cs b/Views/LabelTimeDemo.Designer.cs new file mode 100644 index 0000000..aadb710 --- /dev/null +++ b/Views/LabelTimeDemo.Designer.cs @@ -0,0 +1,128 @@ +namespace AntdUIDemo.Views +{ + partial class LabelTimeDemo + { + /// + /// 必需的设计器变量。 + /// + 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.header1 = new AntdUI.PageHeader(); + this.stackPanel1 = new AntdUI.StackPanel(); + this.flowPanel2 = new AntdUI.FlowPanel(); + this.labelTime1 = new AntdUI.LabelTime(); + this.labelTime2 = new AntdUI.LabelTime(); + this.label3 = new AntdUI.Label(); + this.stackPanel1.SuspendLayout(); + this.flowPanel2.SuspendLayout(); + this.SuspendLayout(); + // + // header1 + // + this.header1.Description = "显示实时日期时间的文本。"; + this.header1.DividerShow = true; + this.header1.Dock = System.Windows.Forms.DockStyle.Top; + this.header1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.header1.Location = new System.Drawing.Point(0, 0); + this.header1.Name = "header1"; + this.header1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); + this.header1.Size = new System.Drawing.Size(750, 74); + this.header1.TabIndex = 28; + this.header1.Text = "LabelTime 时间标签"; + this.header1.UseTitleFont = true; + // + // stackPanel1 + // + this.stackPanel1.Controls.Add(this.flowPanel2); + this.stackPanel1.Controls.Add(this.label3); + this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stackPanel1.Location = new System.Drawing.Point(0, 74); + this.stackPanel1.Name = "stackPanel1"; + this.stackPanel1.Size = new System.Drawing.Size(750, 393); + this.stackPanel1.TabIndex = 29; + this.stackPanel1.Text = "stackPanel1"; + this.stackPanel1.Vertical = true; + // + // flowPanel2 + // + this.flowPanel2.Controls.Add(this.labelTime1); + this.flowPanel2.Controls.Add(this.labelTime2); + this.flowPanel2.Location = new System.Drawing.Point(3, 33); + this.flowPanel2.Name = "flowPanel2"; + this.flowPanel2.Size = new System.Drawing.Size(744, 76); + this.flowPanel2.TabIndex = 41; + this.flowPanel2.Text = "flowPanel2"; + // + // labelTime1 + // + this.labelTime1.BadgeSize = 1F; + this.labelTime1.BadgeSvg = "FieldTimeOutlined"; + this.labelTime1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + this.labelTime1.Location = new System.Drawing.Point(309, 3); + this.labelTime1.Name = "labelTime1"; + this.labelTime1.ShowTime = false; + this.labelTime1.Size = new System.Drawing.Size(300, 70); + this.labelTime1.TabIndex = 2; + this.labelTime1.Text = "labelTime1"; + // + // labelTime2 + // + this.labelTime2.Location = new System.Drawing.Point(3, 3); + this.labelTime2.Name = "labelTime2"; + this.labelTime2.Size = new System.Drawing.Size(300, 70); + this.labelTime2.TabIndex = 1; + this.labelTime2.Text = "labelTime2"; + // + // 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(744, 24); + this.label3.TabIndex = 26; + this.label3.Text = "基本用法"; + // + // LabelTimeDemo + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; + this.Controls.Add(this.stackPanel1); + this.Controls.Add(this.header1); + this.Name = "LabelTimeDemo"; + this.Size = new System.Drawing.Size(750, 467); + this.stackPanel1.ResumeLayout(false); + this.flowPanel2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private AntdUI.PageHeader header1; + private AntdUI.StackPanel stackPanel1; + private AntdUI.Label label3; + private AntdUI.FlowPanel flowPanel2; + private AntdUI.LabelTime labelTime1; + private AntdUI.LabelTime labelTime2; + } +} diff --git a/Views/LabelTimeDemo.cs b/Views/LabelTimeDemo.cs new file mode 100644 index 0000000..2d90665 --- /dev/null +++ b/Views/LabelTimeDemo.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 LabelTimeDemo : UserControl + { + public LabelTimeDemo() + { + InitializeComponent(); + } + } +} diff --git a/Views/LabelTimeDemo.resx b/Views/LabelTimeDemo.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Views/LabelTimeDemo.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/TableDemo.Designer.cs b/Views/TableDemo.Designer.cs index d841557..d40323f 100644 --- a/Views/TableDemo.Designer.cs +++ b/Views/TableDemo.Designer.cs @@ -72,20 +72,20 @@ this.stackPanel1.Name = "stackPanel1"; this.stackPanel1.Padding = new System.Windows.Forms.Padding(3); this.stackPanel1.Radius = 0; - this.stackPanel1.Size = new System.Drawing.Size(750, 486); + this.stackPanel1.Size = new System.Drawing.Size(750, 526); this.stackPanel1.TabIndex = 0; this.stackPanel1.Text = "stackPanel1"; // // table_base // - this.table_base.Dock = System.Windows.Forms.DockStyle.Fill; + this.table_base.Dock = System.Windows.Forms.DockStyle.Top; this.table_base.EmptyHeader = true; this.table_base.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.table_base.Gap = 8; this.table_base.Location = new System.Drawing.Point(3, 103); this.table_base.Name = "table_base"; this.table_base.ShowTip = false; - this.table_base.Size = new System.Drawing.Size(744, 380); + this.table_base.Size = new System.Drawing.Size(744, 417); this.table_base.TabIndex = 30; this.table_base.Text = "table1"; // @@ -226,7 +226,7 @@ this.Controls.Add(this.stackPanel1); this.Controls.Add(this.header1); this.Name = "TableDemo"; - this.Size = new System.Drawing.Size(750, 560); + this.Size = new System.Drawing.Size(750, 600); this.stackPanel1.ResumeLayout(false); this.flowPanel1.ResumeLayout(false); this.flowPanel1.PerformLayout(); diff --git a/Views/TableDemo.cs b/Views/TableDemo.cs index 1cec4b2..1440ad7 100644 --- a/Views/TableDemo.cs +++ b/Views/TableDemo.cs @@ -2,6 +2,7 @@ using AntdUIDemo.Models; using AntdUIDemo.Views.Table; using System; +using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Threading; @@ -27,7 +28,11 @@ namespace AntdUIDemo.Views { table_base.Columns = new ColumnCollection() { new ColumnCheck("Selected"){Fixed = true}, - new Column("Name", "姓名",ColumnAlign.Center), + new Column("Name", "姓名", ColumnAlign.Center) + { + Width="120", + KeyTree = "Users" + }, new Column("Age", "年龄",ColumnAlign.Center), new Column("Address", "地址"){ Width = "120", @@ -264,26 +269,52 @@ namespace AntdUIDemo.Views { if (antList.Count == 0 || !antList.Any(x => x.Selected)) { - AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3); - return; + bool isSubSelected = false; + // 判断子元素是否勾选 + for (int i = 0; i < antList.Count; i++) + { + if (antList[i].Users !=null && antList[i].Users.Any(x => x.Selected)) + { + isSubSelected = true; + break; + } + } + if (!isSubSelected) + { + AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3); + return; + } } + var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn); if (result == DialogResult.OK) { - //使用反转for循环删除 + // 使用反转for循环删除主列表中选中的项 for (int i = antList.Count - 1; i >= 0; i--) { + // 删除选中的主列表项 if (antList[i].Selected) { - antList.Remove(antList[i]); + antList.RemoveAt(i); + } + else + { + // 删除子列表中选中的项 + antList[i].Users = antList[i].Users?.Where(user => !user.Selected).ToArray(); } } + //BUG:删除树节点数据需要重新绑定才刷新 + table_base.Binding(antList); + // 提示删除完成 + AntdUI.Message.success(window, "删除成功!", autoClose: 3); } } + + private void InitData() { - antList = new AntList(10); + antList = new AntList(); for (int i = 0; i < 10; i++) { @@ -309,7 +340,35 @@ namespace AntdUIDemo.Views CellDivider = new CellDivider(), }); } - table_base.Binding(antList); + + List subUsers = new List(); + for (int i = 0; i < 3; i++) + { + subUsers.Add(new User() + { + Name = "李四", + Age = 30 + i, + Address = $"上海市东方明珠{i + 1}号", + Enabled = i % 2 == 0, + CellImages = new CellImage[] { new CellImage(Properties.Resources.head) }, + CellTags = new CellTag[] { new CellTag("测试", TTypeMini.Primary) }, + CellBadge = new CellBadge(TState.Success, "已完成"), + CellText = new CellText("这是一个带图标的文本") + { + IconRatio = 0.5f, + PrefixSvg = "" + }, + CellLinks = new CellLink[] {new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI")}, + //value:0-1 + CellProgress = new CellProgress(1f), + CellDivider = new CellDivider(), + }); + } + + //设置树数据,可为任意行设置 + + antList[1].Users = subUsers.ToArray(); + table_base.Binding(antList); } } } diff --git a/Views/TimePickerDemo.Designer.cs b/Views/TimePickerDemo.Designer.cs index 8d2e3bd..14f6994 100644 --- a/Views/TimePickerDemo.Designer.cs +++ b/Views/TimePickerDemo.Designer.cs @@ -52,6 +52,7 @@ this.timePicker1 = new AntdUI.TimePicker(); this.label3 = new AntdUI.Label(); this.header1 = new AntdUI.PageHeader(); + this.timePicker14 = new AntdUI.TimePicker(); this.stackPanel1.SuspendLayout(); this.flowPanel4.SuspendLayout(); this.flowPanel3.SuspendLayout(); @@ -289,6 +290,7 @@ // // flowPanel1 // + this.flowPanel1.Controls.Add(this.timePicker14); this.flowPanel1.Controls.Add(this.timePicker7); this.flowPanel1.Controls.Add(this.timePicker1); this.flowPanel1.Gap = 6; @@ -347,6 +349,20 @@ this.header1.Text = "TimePicker 时间选择框"; this.header1.UseTitleFont = true; // + // timePicker14 + // + this.timePicker14.DropDownArrow = true; + this.timePicker14.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.timePicker14.Location = new System.Drawing.Point(427, 3); + this.timePicker14.Name = "timePicker14"; + this.timePicker14.PlaceholderText = "时间水平对齐"; + this.timePicker14.Size = new System.Drawing.Size(200, 32); + this.timePicker14.TabIndex = 2; + this.timePicker14.Text = "08:00:00"; + this.timePicker14.Value = System.TimeSpan.Parse("08:00:00"); + this.timePicker14.ValueTimeHorizontal = true; + this.timePicker14.WaveSize = 0; + // // TimePickerDemo // this.Controls.Add(this.stackPanel1); @@ -387,5 +403,6 @@ private AntdUI.TimePicker timePicker9; private AntdUI.Label label6; private AntdUI.PageHeader header1; + private AntdUI.TimePicker timePicker14; } }