继续完善table
This commit is contained in:
parent
3d7611e546
commit
9b0ea239b7
@ -21,7 +21,8 @@ namespace AntdUIDemo.Models
|
||||
new MenuItems { Text = "FlowPanel 流动布局", Tag = "FlowPanel"},
|
||||
new MenuItems { Text = "GridPanel 网格布局", Tag = "GridPanel"},
|
||||
new MenuItems { Text = "Panel 面板", Tag = "Panel"},
|
||||
new MenuItems { Text = "StackPanel 堆叠布局", Tag = "StackPanel"}
|
||||
new MenuItems { Text = "StackPanel 堆叠布局", Tag = "StackPanel"},
|
||||
new MenuItems { Text = "VirtualPanel 虚拟布局", Tag = "VirtualPanel"}
|
||||
}
|
||||
},
|
||||
{ "导航", new List<MenuItems>
|
||||
|
||||
@ -10,12 +10,11 @@ namespace AntdUIDemo.Models
|
||||
{
|
||||
public class User : NotifyProperty
|
||||
{
|
||||
private int id { get; set; }
|
||||
private bool selected;
|
||||
private bool selected = false;
|
||||
private string name;
|
||||
private int age;
|
||||
private int age = 0;
|
||||
private string address;
|
||||
private bool enabled;
|
||||
private bool enabled = false;
|
||||
private CellImage[] cellImages;
|
||||
private CellTag[] cellTags;
|
||||
private CellBadge cellBadge;
|
||||
@ -24,17 +23,6 @@ namespace AntdUIDemo.Models
|
||||
private CellProgress cellProgress;
|
||||
private CellDivider cellDivider;
|
||||
|
||||
public int Id
|
||||
{
|
||||
get { return id; }
|
||||
set
|
||||
{
|
||||
if (id == value) return;
|
||||
id = value;
|
||||
OnPropertyChanged(nameof(Id));
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected
|
||||
{
|
||||
get { return selected; }
|
||||
|
||||
10
Properties/Resources.Designer.cs
generated
10
Properties/Resources.Designer.cs
generated
@ -90,6 +90,16 @@ namespace AntdUIDemo.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap head {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("head", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
|
||||
@ -127,6 +127,9 @@
|
||||
<data name="bg3" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\bg3.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="head" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\head.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="关闭" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\关闭.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
```
|
||||
## ⚠️ 注意事项
|
||||
- 电脑屏幕分辨率低于 1920×1080(1080P) 请使用大于等于 1080P 分辨率的屏幕开发
|
||||
- 电脑屏幕分辨率大于 1080P 或者缩放不是 100% 的,可选择以下 **任一方式** 运行项目
|
||||
- 电脑屏幕分辨率大于 1080P 或者缩放不是 100% 的,务必选择以下 **任一方式** 运行项目
|
||||
1. 按照上述 **快速开始** 的第二条打开项目,详细原因见 [解决 Visual Studio 中 Windows 窗体设计器的 HDPI/缩放问题](https://learn.microsoft.com/zh-cn/visualstudio/designers/disable-dpi-awareness?view=vs-2022) ,如下所示
|
||||

|
||||
2. 直接打开项目,在窗口页面提示点击 **使用 100% 缩放比例重新启动 Visual Studio**,如下所示
|
||||
@ -48,6 +48,7 @@
|
||||

|
||||
#### StackPanel 堆叠布局
|
||||

|
||||
#### VirtualPanel 虚拟布局
|
||||
|
||||
### 导航
|
||||
#### Dropdown 下拉菜单
|
||||
|
||||
BIN
Resources/head.png
Normal file
BIN
Resources/head.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 120 KiB |
@ -13,9 +13,12 @@ namespace AntdUIDemo.Views.Table
|
||||
{
|
||||
public partial class UserEdit : UserControl
|
||||
{
|
||||
private AntdUI.Window window;
|
||||
private User user;
|
||||
public UserEdit(User _user)
|
||||
public bool submit;
|
||||
public UserEdit(AntdUI.Window _window, User _user)
|
||||
{
|
||||
this.window = _window;
|
||||
user = _user;
|
||||
InitializeComponent();
|
||||
//设置默认值
|
||||
@ -32,6 +35,7 @@ namespace AntdUIDemo.Views.Table
|
||||
|
||||
private void Button_cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
submit = false;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
@ -42,10 +46,13 @@ namespace AntdUIDemo.Views.Table
|
||||
if (String.IsNullOrEmpty(input_name.Text))
|
||||
{
|
||||
input_name.Status = AntdUI.TType.Error;
|
||||
AntdUI.Message.warn(window, "姓名不能为空!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
user.Name = input_name.Text;
|
||||
user.Address = input_addr.Text;
|
||||
user.Age = (int)input_age.Value;
|
||||
submit = true;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
|
||||
191
Views/TableDemo.Designer.cs
generated
191
Views/TableDemo.Designer.cs
generated
@ -29,17 +29,15 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.stackPanel1 = new AntdUI.StackPanel();
|
||||
this.label4 = new AntdUI.Label();
|
||||
this.table_base = new AntdUI.Table();
|
||||
this.flowPanel1 = new AntdUI.FlowPanel();
|
||||
this.checkbox5 = new AntdUI.Checkbox();
|
||||
this.checkbox4 = new AntdUI.Checkbox();
|
||||
this.checkbox3 = new AntdUI.Checkbox();
|
||||
this.checkbox2 = new AntdUI.Checkbox();
|
||||
this.checkbox6 = new AntdUI.Checkbox();
|
||||
this.checkbox1 = new AntdUI.Checkbox();
|
||||
this.checkbox_sort = new AntdUI.Checkbox();
|
||||
this.checkbox_rowstyle = new AntdUI.Checkbox();
|
||||
this.checkbox_border = new AntdUI.Checkbox();
|
||||
this.checkbox_columndragsort = new AntdUI.Checkbox();
|
||||
this.checkbox_visibleheader = new AntdUI.Checkbox();
|
||||
this.checkbox_fixheader = new AntdUI.Checkbox();
|
||||
this.flowPanel3 = new AntdUI.FlowPanel();
|
||||
this.buttonCZ = new AntdUI.Button();
|
||||
this.buttonDEL = new AntdUI.Button();
|
||||
this.buttonADD = new AntdUI.Button();
|
||||
this.label3 = new AntdUI.Label();
|
||||
@ -53,7 +51,6 @@
|
||||
//
|
||||
// stackPanel1
|
||||
//
|
||||
this.stackPanel1.Controls.Add(this.label4);
|
||||
this.stackPanel1.Controls.Add(this.table_base);
|
||||
this.stackPanel1.Controls.Add(this.flowPanel1);
|
||||
this.stackPanel1.Controls.Add(this.flowPanel3);
|
||||
@ -64,116 +61,112 @@
|
||||
this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.stackPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.stackPanel1.Name = "stackPanel1";
|
||||
this.stackPanel1.Size = new System.Drawing.Size(700, 770);
|
||||
this.stackPanel1.Size = new System.Drawing.Size(700, 560);
|
||||
this.stackPanel1.TabIndex = 0;
|
||||
this.stackPanel1.Text = "stackPanel1";
|
||||
this.stackPanel1.Vertical = true;
|
||||
//
|
||||
// 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, 509);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(694, 24);
|
||||
this.label4.TabIndex = 31;
|
||||
this.label4.Text = "分页";
|
||||
//
|
||||
// table_base
|
||||
//
|
||||
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.Location = new System.Drawing.Point(3, 199);
|
||||
this.table_base.Location = new System.Drawing.Point(3, 215);
|
||||
this.table_base.Name = "table_base";
|
||||
this.table_base.ShowTip = false;
|
||||
this.table_base.Size = new System.Drawing.Size(694, 304);
|
||||
this.table_base.Size = new System.Drawing.Size(694, 342);
|
||||
this.table_base.TabIndex = 30;
|
||||
this.table_base.Text = "table1";
|
||||
//
|
||||
// flowPanel1
|
||||
//
|
||||
this.flowPanel1.Controls.Add(this.checkbox5);
|
||||
this.flowPanel1.Controls.Add(this.checkbox4);
|
||||
this.flowPanel1.Controls.Add(this.checkbox3);
|
||||
this.flowPanel1.Controls.Add(this.checkbox2);
|
||||
this.flowPanel1.Controls.Add(this.checkbox6);
|
||||
this.flowPanel1.Controls.Add(this.checkbox1);
|
||||
this.flowPanel1.Controls.Add(this.checkbox_sort);
|
||||
this.flowPanel1.Controls.Add(this.checkbox_rowstyle);
|
||||
this.flowPanel1.Controls.Add(this.checkbox_border);
|
||||
this.flowPanel1.Controls.Add(this.checkbox_columndragsort);
|
||||
this.flowPanel1.Controls.Add(this.checkbox_visibleheader);
|
||||
this.flowPanel1.Controls.Add(this.checkbox_fixheader);
|
||||
this.flowPanel1.Location = new System.Drawing.Point(3, 171);
|
||||
this.flowPanel1.Name = "flowPanel1";
|
||||
this.flowPanel1.Size = new System.Drawing.Size(694, 22);
|
||||
this.flowPanel1.Size = new System.Drawing.Size(694, 38);
|
||||
this.flowPanel1.TabIndex = 29;
|
||||
this.flowPanel1.Text = "flowPanel1";
|
||||
//
|
||||
// checkbox5
|
||||
// checkbox_sort
|
||||
//
|
||||
this.checkbox5.AutoCheck = true;
|
||||
this.checkbox5.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox5.Location = new System.Drawing.Point(466, 0);
|
||||
this.checkbox5.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox5.Name = "checkbox5";
|
||||
this.checkbox5.Size = new System.Drawing.Size(66, 20);
|
||||
this.checkbox5.TabIndex = 21;
|
||||
this.checkbox5.Text = "排序";
|
||||
this.checkbox_sort.AutoCheck = true;
|
||||
this.checkbox_sort.AutoSizeMode = AntdUI.TAutoSize.Auto;
|
||||
this.checkbox_sort.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox_sort.Location = new System.Drawing.Point(466, 0);
|
||||
this.checkbox_sort.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox_sort.Name = "checkbox_sort";
|
||||
this.checkbox_sort.Size = new System.Drawing.Size(66, 37);
|
||||
this.checkbox_sort.TabIndex = 21;
|
||||
this.checkbox_sort.Text = "排序";
|
||||
//
|
||||
// checkbox4
|
||||
// checkbox_rowstyle
|
||||
//
|
||||
this.checkbox4.AutoCheck = true;
|
||||
this.checkbox4.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox4.Location = new System.Drawing.Point(388, 0);
|
||||
this.checkbox4.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox4.Name = "checkbox4";
|
||||
this.checkbox4.Size = new System.Drawing.Size(78, 20);
|
||||
this.checkbox4.TabIndex = 20;
|
||||
this.checkbox4.Text = "奇偶列";
|
||||
this.checkbox_rowstyle.AutoCheck = true;
|
||||
this.checkbox_rowstyle.AutoSizeMode = AntdUI.TAutoSize.Auto;
|
||||
this.checkbox_rowstyle.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox_rowstyle.Location = new System.Drawing.Point(388, 0);
|
||||
this.checkbox_rowstyle.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox_rowstyle.Name = "checkbox_rowstyle";
|
||||
this.checkbox_rowstyle.Size = new System.Drawing.Size(78, 37);
|
||||
this.checkbox_rowstyle.TabIndex = 20;
|
||||
this.checkbox_rowstyle.Text = "奇偶列";
|
||||
//
|
||||
// checkbox3
|
||||
// checkbox_border
|
||||
//
|
||||
this.checkbox3.AutoCheck = true;
|
||||
this.checkbox3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox3.Location = new System.Drawing.Point(285, 0);
|
||||
this.checkbox3.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox3.Name = "checkbox3";
|
||||
this.checkbox3.Size = new System.Drawing.Size(103, 20);
|
||||
this.checkbox3.TabIndex = 19;
|
||||
this.checkbox3.Text = "显示列边框";
|
||||
this.checkbox_border.AutoCheck = true;
|
||||
this.checkbox_border.AutoSizeMode = AntdUI.TAutoSize.Auto;
|
||||
this.checkbox_border.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox_border.Location = new System.Drawing.Point(285, 0);
|
||||
this.checkbox_border.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox_border.Name = "checkbox_border";
|
||||
this.checkbox_border.Size = new System.Drawing.Size(103, 37);
|
||||
this.checkbox_border.TabIndex = 19;
|
||||
this.checkbox_border.Text = "显示列边框";
|
||||
//
|
||||
// checkbox2
|
||||
// checkbox_columndragsort
|
||||
//
|
||||
this.checkbox2.AutoCheck = true;
|
||||
this.checkbox2.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox2.Location = new System.Drawing.Point(182, 0);
|
||||
this.checkbox2.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox2.Name = "checkbox2";
|
||||
this.checkbox2.Size = new System.Drawing.Size(103, 20);
|
||||
this.checkbox2.TabIndex = 18;
|
||||
this.checkbox2.Text = "列拖拽排序";
|
||||
this.checkbox_columndragsort.AutoCheck = true;
|
||||
this.checkbox_columndragsort.AutoSizeMode = AntdUI.TAutoSize.Auto;
|
||||
this.checkbox_columndragsort.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox_columndragsort.Location = new System.Drawing.Point(182, 0);
|
||||
this.checkbox_columndragsort.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox_columndragsort.Name = "checkbox_columndragsort";
|
||||
this.checkbox_columndragsort.Size = new System.Drawing.Size(103, 37);
|
||||
this.checkbox_columndragsort.TabIndex = 18;
|
||||
this.checkbox_columndragsort.Text = "列拖拽排序";
|
||||
//
|
||||
// checkbox6
|
||||
// checkbox_visibleheader
|
||||
//
|
||||
this.checkbox6.AutoCheck = true;
|
||||
this.checkbox6.Checked = true;
|
||||
this.checkbox6.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox6.Location = new System.Drawing.Point(91, 0);
|
||||
this.checkbox6.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox6.Name = "checkbox6";
|
||||
this.checkbox6.Size = new System.Drawing.Size(91, 20);
|
||||
this.checkbox6.TabIndex = 17;
|
||||
this.checkbox6.Text = "显示表头";
|
||||
this.checkbox_visibleheader.AutoCheck = true;
|
||||
this.checkbox_visibleheader.AutoSizeMode = AntdUI.TAutoSize.Auto;
|
||||
this.checkbox_visibleheader.Checked = true;
|
||||
this.checkbox_visibleheader.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox_visibleheader.Location = new System.Drawing.Point(91, 0);
|
||||
this.checkbox_visibleheader.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox_visibleheader.Name = "checkbox_visibleheader";
|
||||
this.checkbox_visibleheader.Size = new System.Drawing.Size(91, 37);
|
||||
this.checkbox_visibleheader.TabIndex = 17;
|
||||
this.checkbox_visibleheader.Text = "显示表头";
|
||||
//
|
||||
// checkbox1
|
||||
// checkbox_fixheader
|
||||
//
|
||||
this.checkbox1.AutoCheck = true;
|
||||
this.checkbox1.Checked = true;
|
||||
this.checkbox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.checkbox1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox1.Name = "checkbox1";
|
||||
this.checkbox1.Size = new System.Drawing.Size(91, 20);
|
||||
this.checkbox1.TabIndex = 12;
|
||||
this.checkbox1.Text = "固定表头";
|
||||
this.checkbox_fixheader.AutoCheck = true;
|
||||
this.checkbox_fixheader.AutoSizeMode = AntdUI.TAutoSize.Auto;
|
||||
this.checkbox_fixheader.Checked = true;
|
||||
this.checkbox_fixheader.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.checkbox_fixheader.Location = new System.Drawing.Point(0, 0);
|
||||
this.checkbox_fixheader.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.checkbox_fixheader.Name = "checkbox_fixheader";
|
||||
this.checkbox_fixheader.Size = new System.Drawing.Size(91, 37);
|
||||
this.checkbox_fixheader.TabIndex = 12;
|
||||
this.checkbox_fixheader.Text = "固定表头";
|
||||
//
|
||||
// flowPanel3
|
||||
//
|
||||
this.flowPanel3.Controls.Add(this.buttonCZ);
|
||||
this.flowPanel3.Controls.Add(this.buttonDEL);
|
||||
this.flowPanel3.Controls.Add(this.buttonADD);
|
||||
this.flowPanel3.Location = new System.Drawing.Point(3, 127);
|
||||
@ -182,17 +175,6 @@
|
||||
this.flowPanel3.TabIndex = 27;
|
||||
this.flowPanel3.Text = "flowPanel3";
|
||||
//
|
||||
// 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(175, 3);
|
||||
this.buttonCZ.Name = "buttonCZ";
|
||||
this.buttonCZ.Size = new System.Drawing.Size(80, 32);
|
||||
this.buttonCZ.TabIndex = 6;
|
||||
this.buttonCZ.Text = "重置";
|
||||
this.buttonCZ.Type = AntdUI.TTypeMini.Warn;
|
||||
this.buttonCZ.WaveSize = 0;
|
||||
//
|
||||
// buttonDEL
|
||||
//
|
||||
this.buttonDEL.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
@ -254,9 +236,10 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
|
||||
this.Controls.Add(this.stackPanel1);
|
||||
this.Name = "TableDemo";
|
||||
this.Size = new System.Drawing.Size(700, 770);
|
||||
this.Size = new System.Drawing.Size(700, 560);
|
||||
this.stackPanel1.ResumeLayout(false);
|
||||
this.flowPanel1.ResumeLayout(false);
|
||||
this.flowPanel1.PerformLayout();
|
||||
this.flowPanel3.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@ -274,13 +257,11 @@
|
||||
private AntdUI.Button buttonDEL;
|
||||
private AntdUI.Table table_base;
|
||||
private AntdUI.FlowPanel flowPanel1;
|
||||
private AntdUI.Checkbox checkbox6;
|
||||
private AntdUI.Checkbox checkbox1;
|
||||
private AntdUI.Checkbox checkbox5;
|
||||
private AntdUI.Checkbox checkbox4;
|
||||
private AntdUI.Checkbox checkbox3;
|
||||
private AntdUI.Checkbox checkbox2;
|
||||
private AntdUI.Label label4;
|
||||
private AntdUI.Button buttonCZ;
|
||||
private AntdUI.Checkbox checkbox_visibleheader;
|
||||
private AntdUI.Checkbox checkbox_fixheader;
|
||||
private AntdUI.Checkbox checkbox_sort;
|
||||
private AntdUI.Checkbox checkbox_rowstyle;
|
||||
private AntdUI.Checkbox checkbox_border;
|
||||
private AntdUI.Checkbox checkbox_columndragsort;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,14 +2,9 @@
|
||||
using AntdUIDemo.Models;
|
||||
using AntdUIDemo.Views.Table;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AntdUIDemo.Views
|
||||
@ -50,7 +45,7 @@ namespace AntdUIDemo.Views
|
||||
new Column("CellImages", "图片",ColumnAlign.Center),
|
||||
new Column("CellTags", "标签",ColumnAlign.Center),
|
||||
new Column("CellBadge", "徽标",ColumnAlign.Center),
|
||||
new Column("CellText", "富文本",ColumnAlign.Center),
|
||||
new Column("CellText", "富文本"),
|
||||
new Column("CellProgress", "进度条",ColumnAlign.Center),
|
||||
new Column("CellDivider", "分割线",ColumnAlign.Center),
|
||||
new Column("CellLinks", "链接",ColumnAlign.Center),
|
||||
@ -59,12 +54,87 @@ namespace AntdUIDemo.Views
|
||||
|
||||
private void BindEventHandler()
|
||||
{
|
||||
buttonADD.Click += ButtonADD_Click;
|
||||
buttonDEL.Click += ButtonDEL_Click;
|
||||
|
||||
checkbox_border.CheckedChanged += Checkbox_CheckedChanged;
|
||||
checkbox_columndragsort.CheckedChanged += Checkbox_CheckedChanged;
|
||||
checkbox_fixheader.CheckedChanged += Checkbox_CheckedChanged;
|
||||
checkbox_rowstyle.CheckedChanged += Checkbox_rowstyle_CheckedChanged;
|
||||
checkbox_sort.CheckedChanged += Checkbox_CheckedChanged;
|
||||
checkbox_visibleheader.CheckedChanged += Checkbox_CheckedChanged;
|
||||
|
||||
table_base.CellClick += Table_base_CellClick;
|
||||
table_base.CellButtonClick += Table_base_CellButtonClick;
|
||||
}
|
||||
|
||||
private void Checkbox_rowstyle_CheckedChanged(object sender, BoolEventArgs e)
|
||||
{
|
||||
if (e.Value)
|
||||
{
|
||||
table_base.SetRowStyle += Table_base_SetRowStyle;
|
||||
table_base.Invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
table_base.SetRowStyle -= Table_base_SetRowStyle;
|
||||
table_base.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void Checkbox_CheckedChanged(object sender, BoolEventArgs e)
|
||||
{
|
||||
table_base.Bordered = checkbox_border.Checked;
|
||||
table_base.ColumnDragSort = checkbox_columndragsort.Checked;
|
||||
table_base.FixedHeader = checkbox_fixheader.Checked;
|
||||
table_base.VisibleHeader = checkbox_visibleheader.Checked;
|
||||
|
||||
foreach (var item in table_base.Columns)
|
||||
{
|
||||
item.SortOrder = checkbox_sort.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
private AntdUI.Table.CellStyleInfo Table_base_SetRowStyle(object sender, TableSetRowStyleEventArgs e)
|
||||
{
|
||||
if (e.RowIndex % 2 == 0)
|
||||
{
|
||||
return new AntdUI.Table.CellStyleInfo
|
||||
{
|
||||
BackColor = AntdUI.Style.Db.ErrorBg,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void ButtonADD_Click(object sender, EventArgs e)
|
||||
{
|
||||
User useradd = new User()
|
||||
{
|
||||
CellBadge = new CellBadge(TState.Processing, "测试中"),
|
||||
CellImages = [new CellImage(Properties.Resources.head)],
|
||||
CellDivider = new CellDivider(),
|
||||
CellTags = [new CellTag("测试", TTypeMini.Primary), new CellTag("测试", TTypeMini.Success), new CellTag("测试", TTypeMini.Warn)],
|
||||
CellText = new CellText("这是一个无图标的文本"),
|
||||
CellProgress = new CellProgress(0.5f),
|
||||
CellLinks = [new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI"),
|
||||
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
|
||||
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error)],
|
||||
};
|
||||
var form = new UserEdit(window, useradd) { Size = new Size(700, 400) };
|
||||
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
|
||||
{
|
||||
BtnHeight = 0,
|
||||
Keyboard = false,
|
||||
MaskClosable = false,
|
||||
});
|
||||
if (form.submit)
|
||||
{
|
||||
antList.Add(useradd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Table_base_CellClick(object sender, TableClickEventArgs e)
|
||||
{
|
||||
var record = e.Record;
|
||||
@ -78,10 +148,9 @@ namespace AntdUIDemo.Views
|
||||
{
|
||||
if (item.Text == "编辑")
|
||||
{
|
||||
var form = new UserEdit(user) { Size = new Size(500, 300) };
|
||||
var form = new UserEdit(window, user) { Size = new Size(500, 300) };
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
MaskClosable = true,
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
|
||||
@ -96,7 +165,16 @@ namespace AntdUIDemo.Views
|
||||
{
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
antList.Remove(user);
|
||||
{
|
||||
//使用反转for循环删除
|
||||
for (int i = antList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (antList[i].Selected)
|
||||
{
|
||||
antList.Remove(antList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
AntdUI.Message.info(window, item.Text, autoClose: 1);
|
||||
@ -130,10 +208,9 @@ namespace AntdUIDemo.Views
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new UserEdit(user) { Size = new Size(500, 300) };
|
||||
var form = new UserEdit(window, user) { Size = new Size(500, 300) };
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
MaskClosable = true,
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
|
||||
@ -158,7 +235,23 @@ namespace AntdUIDemo.Views
|
||||
|
||||
private void ButtonDEL_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (antList.Count == 0 || !antList.Any(x => x.Selected))
|
||||
{
|
||||
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
//使用反转for循环删除
|
||||
for (int i = antList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (antList[i].Selected)
|
||||
{
|
||||
antList.Remove(antList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitData()
|
||||
@ -169,13 +262,11 @@ namespace AntdUIDemo.Views
|
||||
{
|
||||
antList.Add(new User
|
||||
{
|
||||
Id = i,
|
||||
Selected = false,
|
||||
Name = "张三",
|
||||
Age = 30,
|
||||
Age = 30 + i,
|
||||
Address = $"浙江省杭州市西湖区湖底公园{i + 1}号",
|
||||
Enabled = i % 2 == 0,
|
||||
//CellImages = [new CellImage(Properties.Resources.bg1)],
|
||||
CellImages = [new CellImage(Properties.Resources.head)],
|
||||
CellTags = [new CellTag("测试", TTypeMini.Primary), new CellTag("测试", TTypeMini.Success), new CellTag("测试", TTypeMini.Warn)],
|
||||
CellBadge = new CellBadge(TState.Processing, "测试中"),
|
||||
CellText = new CellText("这是一个带图标的文本")
|
||||
@ -184,8 +275,8 @@ namespace AntdUIDemo.Views
|
||||
PrefixSvg = "<svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"search\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z\"></path></svg>"
|
||||
},
|
||||
CellLinks = [new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI"),
|
||||
new CellButton(i.ToString(),"编辑",TTypeMini.Primary),
|
||||
new CellButton(i.ToString(),"删除",TTypeMini.Error)],
|
||||
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
|
||||
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error)],
|
||||
//value:0-1
|
||||
CellProgress = new CellProgress(0.5f),
|
||||
CellDivider = new CellDivider(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user