This commit is contained in:
czz_y 2024-08-31 19:03:17 +08:00
parent 8d1fa9bf16
commit 3d7611e546
17 changed files with 1512 additions and 27 deletions

View File

@ -235,6 +235,9 @@ namespace AntdUIDemo
case "Table":
control = new TableDemo(this);
break;
case "Drawer":
control = new DrawerDemo(this);
break;
}
if (control != null)
{

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace AntdUIDemo.Models
{
internal class User : NotifyProperty
public class User : NotifyProperty
{
private int id { get; set; }
private bool selected;

89
Views/Demo.Designer.cs generated Normal file
View File

@ -0,0 +1,89 @@
namespace AntdUIDemo.Views
{
partial class Demo
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new AntdUI.Panel();
this.windowBar = new AntdUI.WindowBar();
this.button_close = new AntdUI.Button();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.button_close);
this.panel1.Controls.Add(this.windowBar);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Shadow = 6;
this.panel1.Size = new System.Drawing.Size(500, 420);
this.panel1.TabIndex = 0;
this.panel1.Text = "panel1";
//
// windowBar
//
this.windowBar.Dock = System.Windows.Forms.DockStyle.Top;
this.windowBar.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.windowBar.Location = new System.Drawing.Point(6, 6);
this.windowBar.MaximizeBox = false;
this.windowBar.MinimizeBox = false;
this.windowBar.Name = "windowBar";
this.windowBar.ShowIcon = false;
this.windowBar.Size = new System.Drawing.Size(488, 32);
this.windowBar.TabIndex = 1;
this.windowBar.Text = "DrawerDemo";
//
// button_close
//
this.button_close.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.button_close.Location = new System.Drawing.Point(9, 44);
this.button_close.Name = "button_close";
this.button_close.Size = new System.Drawing.Size(75, 40);
this.button_close.TabIndex = 2;
this.button_close.Text = "关闭";
this.button_close.Type = AntdUI.TTypeMini.Error;
//
// Demo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.panel1);
this.Name = "Demo";
this.Size = new System.Drawing.Size(500, 420);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.WindowBar windowBar;
private AntdUI.Button button_close;
}
}

32
Views/Demo.cs Normal file
View File

@ -0,0 +1,32 @@
using AntdUI;
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 Demo : UserControl
{
public Demo()
{
InitializeComponent();
BindEventHandler();
}
private void BindEventHandler()
{
button_close.Click += button_close_Click;
}
private void button_close_Click(object sender, EventArgs e)
{
this.Dispose();
}
}
}

120
Views/Demo.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

232
Views/DrawerDemo.Designer.cs generated Normal file
View File

@ -0,0 +1,232 @@
namespace AntdUIDemo.Views
{
partial class DrawerDemo
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.stackPanel1 = new AntdUI.StackPanel();
this.label3 = new AntdUI.Label();
this.divider1 = new AntdUI.Divider();
this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label();
this.flowPanel1 = new AntdUI.FlowPanel();
this.button = new AntdUI.Button();
this.label4 = new AntdUI.Label();
this.stackPanel3 = new AntdUI.StackPanel();
this.select_align = new AntdUI.Select();
this.label10 = new AntdUI.Label();
this.switch_mask = new AntdUI.Switch();
this.label5 = new AntdUI.Label();
this.switch_mc = new AntdUI.Switch();
this.label6 = new AntdUI.Label();
this.stackPanel1.SuspendLayout();
this.flowPanel1.SuspendLayout();
this.stackPanel3.SuspendLayout();
this.SuspendLayout();
//
// stackPanel1
//
this.stackPanel1.Controls.Add(this.stackPanel3);
this.stackPanel1.Controls.Add(this.label4);
this.stackPanel1.Controls.Add(this.flowPanel1);
this.stackPanel1.Controls.Add(this.label3);
this.stackPanel1.Controls.Add(this.divider1);
this.stackPanel1.Controls.Add(this.label2);
this.stackPanel1.Controls.Add(this.label1);
this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stackPanel1.Location = new System.Drawing.Point(0, 0);
this.stackPanel1.Name = "stackPanel1";
this.stackPanel1.Size = new System.Drawing.Size(700, 327);
this.stackPanel1.TabIndex = 0;
this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true;
//
// label3
//
this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(3, 97);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(694, 24);
this.label3.TabIndex = 28;
this.label3.Text = "基本用法";
//
// divider1
//
this.divider1.Location = new System.Drawing.Point(3, 79);
this.divider1.Name = "divider1";
this.divider1.Size = new System.Drawing.Size(694, 12);
this.divider1.TabIndex = 27;
//
// 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 = 26;
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 = 25;
this.label1.Text = "Drawer 抽屉";
//
// flowPanel1
//
this.flowPanel1.Controls.Add(this.button);
this.flowPanel1.Location = new System.Drawing.Point(3, 127);
this.flowPanel1.Name = "flowPanel1";
this.flowPanel1.Size = new System.Drawing.Size(694, 38);
this.flowPanel1.TabIndex = 29;
this.flowPanel1.Text = "flowPanel1";
//
// button
//
this.button.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button.Location = new System.Drawing.Point(3, 3);
this.button.Name = "button";
this.button.Size = new System.Drawing.Size(80, 32);
this.button.TabIndex = 1;
this.button.Text = "Open";
this.button.Type = AntdUI.TTypeMini.Primary;
this.button.WaveSize = 0;
//
// label4
//
this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.label4.Location = new System.Drawing.Point(3, 171);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(694, 24);
this.label4.TabIndex = 31;
this.label4.Text = "控件配置";
//
// stackPanel3
//
this.stackPanel3.Controls.Add(this.switch_mc);
this.stackPanel3.Controls.Add(this.label6);
this.stackPanel3.Controls.Add(this.switch_mask);
this.stackPanel3.Controls.Add(this.label5);
this.stackPanel3.Controls.Add(this.select_align);
this.stackPanel3.Controls.Add(this.label10);
this.stackPanel3.Gap = 6;
this.stackPanel3.Location = new System.Drawing.Point(3, 201);
this.stackPanel3.Name = "stackPanel3";
this.stackPanel3.Size = new System.Drawing.Size(694, 38);
this.stackPanel3.TabIndex = 32;
this.stackPanel3.Text = "stackPanel3";
//
// select_align
//
this.select_align.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.select_align.List = true;
this.select_align.Location = new System.Drawing.Point(135, 3);
this.select_align.Name = "select_align";
this.select_align.Size = new System.Drawing.Size(75, 32);
this.select_align.TabIndex = 5;
this.select_align.WaveSize = 0;
//
// label10
//
this.label10.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label10.Location = new System.Drawing.Point(3, 3);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(120, 32);
this.label10.TabIndex = 4;
this.label10.Text = "Align";
//
// switch_mask
//
this.switch_mask.AutoCheck = true;
this.switch_mask.Location = new System.Drawing.Point(354, 3);
this.switch_mask.Name = "switch_mask";
this.switch_mask.Size = new System.Drawing.Size(60, 32);
this.switch_mask.TabIndex = 7;
this.switch_mask.Text = "switch1";
//
// 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(222, 3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(120, 32);
this.label5.TabIndex = 6;
this.label5.Text = "Mask";
//
// switch_mc
//
this.switch_mc.AutoCheck = true;
this.switch_mc.Location = new System.Drawing.Point(558, 3);
this.switch_mc.Name = "switch_mc";
this.switch_mc.Size = new System.Drawing.Size(60, 32);
this.switch_mc.TabIndex = 9;
this.switch_mc.Text = "switch1";
//
// label6
//
this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(426, 3);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(120, 32);
this.label6.TabIndex = 8;
this.label6.Text = "MaskClosable";
//
// DrawerDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.stackPanel1);
this.Name = "DrawerDemo";
this.Size = new System.Drawing.Size(700, 327);
this.stackPanel1.ResumeLayout(false);
this.flowPanel1.ResumeLayout(false);
this.stackPanel3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private AntdUI.StackPanel stackPanel1;
private AntdUI.Label label3;
private AntdUI.Divider divider1;
private AntdUI.Label label2;
private AntdUI.Label label1;
private AntdUI.FlowPanel flowPanel1;
private AntdUI.Button button;
private AntdUI.Label label4;
private AntdUI.StackPanel stackPanel3;
private AntdUI.Select select_align;
private AntdUI.Label label10;
private AntdUI.Switch switch_mask;
private AntdUI.Label label5;
private AntdUI.Switch switch_mc;
private AntdUI.Label label6;
}
}

77
Views/DrawerDemo.cs Normal file
View File

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AntdUI;
using AntdUIDemo.Views.Test;
namespace AntdUIDemo.Views
{
public partial class DrawerDemo : UserControl
{
private AntdUI.Window window;
public DrawerDemo(AntdUI.Window _window)
{
window = _window;
InitializeComponent();
//初始化下拉框
InitSelectItems();
//设置默认值
InitData();
// 绑定事件
BindEventHandler();
}
private void BindEventHandler()
{
button.Click += Button_click;
switch_mask.CheckedChanged += switch_mask_CheckedChanged;
}
private void switch_mask_CheckedChanged(object sender, BoolEventArgs e)
{
if (e.Value)
{
switch_mc.Enabled = true;
return;
}
//当 mask 为 false 时,maskClosable 无效
switch_mc.Checked = e.Value;
switch_mc.Enabled = e.Value;
}
private void Button_click(object sender, EventArgs e)
{
//TODO:Mask当前版本设置为false时关闭窗口有bug,不建议关闭
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, new Demo() { Size = new Size(500, 300) })
{
Align = (TAlignMini)select_align.SelectedValue,
Mask = switch_mask.Checked,
//当MaskClosable为false时需要弹出窗口自己实现关闭否则无法关闭
MaskClosable = switch_mc.Checked
});
}
private void InitData()
{
select_align.SelectedIndex = 2;
switch_mask.Checked = true;
switch_mc.Checked = true;
}
private void InitSelectItems()
{
select_align.Items.Clear();
foreach (TAlignMini align in Enum.GetValues(typeof(TAlignMini)))
{
select_align.Items.Add(align);
}
}
}
}

120
Views/DrawerDemo.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -150,10 +150,9 @@
this.switch_autoscroll.AutoCheck = true;
this.switch_autoscroll.Location = new System.Drawing.Point(97, 3);
this.switch_autoscroll.Name = "switch_autoscroll";
this.switch_autoscroll.Size = new System.Drawing.Size(60, 26);
this.switch_autoscroll.Size = new System.Drawing.Size(50, 26);
this.switch_autoscroll.TabIndex = 5;
this.switch_autoscroll.Text = "switch1";
this.switch_autoscroll.WaveSize = 0;
//
// label4
//

203
Views/Table/UserEdit.Designer.cs generated Normal file
View File

@ -0,0 +1,203 @@
namespace AntdUIDemo.Views.Table
{
partial class UserEdit
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new AntdUI.Panel();
this.stackPanel1 = new AntdUI.StackPanel();
this.button_ok = new AntdUI.Button();
this.button_cancel = new AntdUI.Button();
this.divider1 = new AntdUI.Divider();
this.input_addr = new AntdUI.Input();
this.label2 = new AntdUI.Label();
this.input_age = new AntdUI.InputNumber();
this.label1 = new AntdUI.Label();
this.input_name = new AntdUI.Input();
this.label3 = new AntdUI.Label();
this.panel1.SuspendLayout();
this.stackPanel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.input_addr);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.input_age);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.input_name);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.divider1);
this.panel1.Controls.Add(this.stackPanel1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(12);
this.panel1.Shadow = 6;
this.panel1.Size = new System.Drawing.Size(500, 386);
this.panel1.TabIndex = 0;
this.panel1.Text = "panel1";
//
// stackPanel1
//
this.stackPanel1.Controls.Add(this.button_cancel);
this.stackPanel1.Controls.Add(this.button_ok);
this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.stackPanel1.Location = new System.Drawing.Point(18, 18);
this.stackPanel1.Name = "stackPanel1";
this.stackPanel1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.stackPanel1.Size = new System.Drawing.Size(464, 44);
this.stackPanel1.TabIndex = 3;
this.stackPanel1.Text = "stackPanel1";
//
// button_ok
//
this.button_ok.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_ok.Location = new System.Drawing.Point(3, 3);
this.button_ok.Name = "button_ok";
this.button_ok.Size = new System.Drawing.Size(75, 38);
this.button_ok.TabIndex = 0;
this.button_ok.Text = "Submit";
this.button_ok.Type = AntdUI.TTypeMini.Primary;
//
// button_cancel
//
this.button_cancel.BorderWidth = 1F;
this.button_cancel.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.button_cancel.Ghost = true;
this.button_cancel.Location = new System.Drawing.Point(84, 3);
this.button_cancel.Name = "button_cancel";
this.button_cancel.Size = new System.Drawing.Size(75, 38);
this.button_cancel.TabIndex = 1;
this.button_cancel.Text = "Cancel";
//
// divider1
//
this.divider1.Dock = System.Windows.Forms.DockStyle.Top;
this.divider1.Location = new System.Drawing.Point(18, 62);
this.divider1.Name = "divider1";
this.divider1.Size = new System.Drawing.Size(464, 12);
this.divider1.TabIndex = 14;
//
// input_addr
//
this.input_addr.Dock = System.Windows.Forms.DockStyle.Top;
this.input_addr.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.input_addr.Location = new System.Drawing.Point(18, 222);
this.input_addr.Name = "input_addr";
this.input_addr.Radius = 3;
this.input_addr.Size = new System.Drawing.Size(464, 38);
this.input_addr.TabIndex = 20;
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
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(18, 198);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(464, 24);
this.label2.TabIndex = 19;
this.label2.Text = "地址";
//
// input_age
//
this.input_age.Dock = System.Windows.Forms.DockStyle.Top;
this.input_age.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.input_age.Location = new System.Drawing.Point(18, 160);
this.input_age.Maximum = new decimal(new int[] {
200,
0,
0,
0});
this.input_age.Minimum = new decimal(new int[] {
0,
0,
0,
0});
this.input_age.Name = "input_age";
this.input_age.Radius = 3;
this.input_age.Size = new System.Drawing.Size(464, 38);
this.input_age.TabIndex = 18;
this.input_age.Text = "0";
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
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(18, 136);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(464, 24);
this.label1.TabIndex = 17;
this.label1.Text = "年龄";
//
// input_name
//
this.input_name.Dock = System.Windows.Forms.DockStyle.Top;
this.input_name.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.input_name.Location = new System.Drawing.Point(18, 98);
this.input_name.Name = "input_name";
this.input_name.Radius = 3;
this.input_name.Size = new System.Drawing.Size(464, 38);
this.input_name.TabIndex = 16;
//
// label3
//
this.label3.Dock = System.Windows.Forms.DockStyle.Top;
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(18, 74);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(464, 24);
this.label3.TabIndex = 15;
this.label3.Text = "姓名";
//
// UserEdit
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.panel1);
this.Name = "UserEdit";
this.Size = new System.Drawing.Size(500, 386);
this.panel1.ResumeLayout(false);
this.stackPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.StackPanel stackPanel1;
private AntdUI.Button button_cancel;
private AntdUI.Button button_ok;
private AntdUI.Divider divider1;
private AntdUI.Input input_addr;
private AntdUI.Label label2;
private AntdUI.InputNumber input_age;
private AntdUI.Label label1;
private AntdUI.Input input_name;
private AntdUI.Label label3;
}
}

59
Views/Table/UserEdit.cs Normal file
View File

@ -0,0 +1,59 @@
using AntdUIDemo.Models;
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.Table
{
public partial class UserEdit : UserControl
{
private User user;
public UserEdit(User _user)
{
user = _user;
InitializeComponent();
//设置默认值
InitData();
// 绑定事件
BindEventHandler();
}
private void BindEventHandler()
{
button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click;
}
private void Button_cancel_Click(object sender, EventArgs e)
{
this.Dispose();
}
private void Button_ok_Click(object sender, EventArgs e)
{
input_name.Status = AntdUI.TType.None;
//检查输入内容
if (String.IsNullOrEmpty(input_name.Text))
{
input_name.Status = AntdUI.TType.Error;
}
user.Name = input_name.Text;
user.Address = input_addr.Text;
user.Age = (int)input_age.Value;
this.Dispose();
}
private void InitData()
{
input_name.Text = user.Name;
input_addr.Text = user.Address;
input_age.Value = user.Age;
}
}
}

120
Views/Table/UserEdit.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -29,6 +29,7 @@
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();
@ -38,14 +39,13 @@
this.checkbox6 = new AntdUI.Checkbox();
this.checkbox1 = 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();
this.divider1 = new AntdUI.Divider();
this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label();
this.label4 = new AntdUI.Label();
this.buttonCZ = new AntdUI.Button();
this.stackPanel1.SuspendLayout();
this.flowPanel1.SuspendLayout();
this.flowPanel3.SuspendLayout();
@ -69,11 +69,22 @@
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.Name = "table_base";
this.table_base.ShowTip = false;
this.table_base.Size = new System.Drawing.Size(694, 304);
this.table_base.TabIndex = 30;
this.table_base.Text = "table1";
@ -171,6 +182,17 @@
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)));
@ -227,26 +249,6 @@
this.label1.TabIndex = 21;
this.label1.Text = "Table 表格";
//
// 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 = "分页";
//
// 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;
//
// TableDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;

View File

@ -1,5 +1,6 @@
using AntdUI;
using AntdUIDemo.Models;
using AntdUIDemo.Views.Table;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -57,6 +58,105 @@ namespace AntdUIDemo.Views
}
private void BindEventHandler()
{
buttonDEL.Click += ButtonDEL_Click;
table_base.CellClick += Table_base_CellClick;
table_base.CellButtonClick += Table_base_CellButtonClick;
}
private void Table_base_CellClick(object sender, TableClickEventArgs e)
{
var record = e.Record;
if (record is User user)
{
//判断是否右键
if (e.Button == MouseButtons.Right)
{
AntdUI.ContextMenuStrip.open(new AntdUI.ContextMenuStrip.Config(table_base,
(item) =>
{
if (item.Text == "编辑")
{
var form = new UserEdit(user) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
MaskClosable = true,
OnLoad = () =>
{
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
}
});
}
else if (item.Text == "删除")
{
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
antList.Remove(user);
}
else
AntdUI.Message.info(window, item.Text, autoClose: 1);
},
[
new AntdUI.ContextMenuStripItem("编辑"){
IconSvg = "<svg t=\"1725101535645\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1082\" width=\"200\" height=\"200\"><path d=\"M867.22 413.07c-9.68 0-19.36-3.63-26.82-10.92-15.19-14.82-15.49-39.14-0.68-54.32 46.84-48.02 45.89-125.18-2.12-172.02-23.27-22.7-54.13-34.93-86.46-34.56-32.49 0.4-62.87 13.43-85.56 36.69-14.83 15.19-39.15 15.47-54.32 0.68-15.19-14.81-15.49-39.13-0.68-54.32C687 45.94 812.9 44.4 891.24 120.82c78.33 76.42 79.89 202.32 3.47 280.66-7.52 7.71-17.51 11.59-27.49 11.59z\" p-id=\"1083\"></path><path d=\"M819.09 462.01c-9.68 0-19.36-3.63-26.82-10.92L563.13 227.55c-15.19-14.82-15.49-39.14-0.68-54.32 14.82-15.2 39.15-15.47 54.32-0.68L845.92 396.1c15.19 14.82 15.49 39.14 0.68 54.32-7.54 7.72-17.52 11.59-27.51 11.59z\" p-id=\"1084\"></path><path d=\"M164.51 674.68c-9.68 0-19.36-3.63-26.82-10.92-15.19-14.82-15.49-39.14-0.68-54.32l473.74-485.6c14.82-15.2 39.15-15.47 54.33-0.67 15.18 14.82 15.48 39.14 0.67 54.33L192.01 663.09c-7.53 7.72-17.52 11.59-27.5 11.59z\" p-id=\"1085\"></path><path d=\"M111.34 958.62c-2.31 0-4.65-0.21-7.01-0.64-20.86-3.85-34.66-23.88-30.81-44.74l51.7-280.46c3.85-20.86 23.86-34.7 44.74-30.81 20.86 3.85 34.66 23.88 30.81 44.74l-51.7 280.46c-3.41 18.5-19.56 31.45-37.73 31.45z\" p-id=\"1086\"></path><path d=\"M393.86 898.44c-9.68 0-19.36-3.63-26.82-10.92-15.19-14.82-15.49-39.14-0.68-54.32L840.1 347.6c14.82-15.19 39.14-15.49 54.32-0.68 15.19 14.82 15.49 39.13 0.68 54.32l-473.74 485.6c-7.53 7.72-17.51 11.6-27.5 11.6z\" p-id=\"1087\"></path><path d=\"M111.3 958.66c-17.79 0-33.76-12.42-37.56-30.52-4.36-20.76 8.93-41.13 29.7-45.49l279.1-58.62c20.8-4.35 41.13 8.93 45.49 29.7 4.36 20.76-8.93 41.13-29.7 45.49l-279.1 58.62c-2.66 0.55-5.31 0.82-7.93 0.82z\" p-id=\"1088\"></path><path d=\"M912.71 959.5H592.59c-21.21 0-38.41-17.2-38.41-38.41 0-21.21 17.2-38.41 38.41-38.41h320.12c21.21 0 38.41 17.2 38.41 38.41 0 21.21-17.2 38.41-38.41 38.41z\" p-id=\"1089\"></path></svg>",
},
new AntdUI.ContextMenuStripItem("删除"){
IconSvg = "<svg t=\"1725101558417\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1250\" width=\"200\" height=\"200\"><path d=\"M783.72 958.39h-539c-41.75 0-75.72-33.46-75.72-74.6V242.5c0-21.18 17.17-38.36 38.36-38.36s38.36 17.17 38.36 38.36v639.17h537V242.5c0-21.18 17.17-38.36 38.36-38.36s38.36 17.17 38.36 38.36v641.29c0 41.14-33.97 74.6-75.72 74.6z\" p-id=\"1251\"></path><path d=\"M706.01 244.51c-21.19 0-38.36-17.17-38.36-38.36v-63.82H360.79v63.82c0 21.18-17.17 38.36-38.36 38.36-21.19 0-38.36-17.17-38.36-38.36v-65.93c0-41.83 27.11-74.6 61.71-74.6h336.87c34.6 0 61.71 32.77 61.71 74.6v65.93c0.01 21.18-17.16 38.36-38.35 38.36z\" p-id=\"1252\"></path><path d=\"M921.14 256.01H102.86c-21.18 0-38.36-17.17-38.36-38.36s17.17-38.36 38.36-38.36h818.29c21.19 0 38.36 17.17 38.36 38.36s-17.18 38.36-38.37 38.36zM514.22 763.27c-21.19 0-38.36-17.17-38.36-38.36V405.27c0-21.18 17.17-38.36 38.36-38.36 21.19 0 38.36 17.17 38.36 38.36v319.64c0 21.18-17.17 38.36-38.36 38.36zM360.79 699.34c-21.19 0-38.36-17.17-38.36-38.36V469.2c0-21.18 17.17-38.36 38.36-38.36s38.36 17.17 38.36 38.36v191.79c0 21.18-17.17 38.35-38.36 38.35zM667.65 699.34c-21.19 0-38.36-17.17-38.36-38.36V469.2c0-21.18 17.17-38.36 38.36-38.36 21.19 0 38.36 17.17 38.36 38.36v191.79c0 21.18-17.17 38.35-38.36 38.35z\" p-id=\"1253\"></path></svg>"
},
new ContextMenuStripItemDivider(),
new AntdUI.ContextMenuStripItem("详情"){
Sub = [ new AntdUI.ContextMenuStripItem("打印", "Ctrl + P") { },
new AntdUI.ContextMenuStripItem("另存为", "Ctrl + S") { } ],
IconSvg = "<svg t=\"1725101601993\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1414\" width=\"200\" height=\"200\"><path d=\"M450.23 831.7c-164.87 0-316.85-108.51-366.94-269.68-30.4-97.82-20.9-201.62 26.76-292.29s127.79-157.35 225.6-187.75c97.83-30.42 201.61-20.9 292.29 26.76 90.67 47.67 157.35 127.79 187.75 225.61 35.78 115.12 16.24 237.58-53.6 335.99a383.494 383.494 0 0 1-43 50.66c-15.04 14.89-39.34 14.78-54.23-0.29-14.9-15.05-14.77-39.34 0.29-54.23a307.844 307.844 0 0 0 34.39-40.52c55.9-78.76 71.54-176.75 42.92-268.84-50.21-161.54-222.49-252.1-384.03-201.9-78.26 24.32-142.35 77.67-180.48 150.2-38.14 72.53-45.74 155.57-21.42 233.83 44.58 143.44 190.03 234.7 338.26 212.42 20.98-3.14 40.48 11.26 43.64 32.2 3.16 20.95-11.26 40.48-32.2 43.64a377.753 377.753 0 0 1-56 4.19z\" p-id=\"1415\"></path><path d=\"M919.84 959.5c-9.81 0-19.63-3.74-27.11-11.24L666.75 722.29c-14.98-14.97-14.98-39.25 0-54.23 14.97-14.98 39.26-14.98 54.23 0l225.97 225.97c14.98 14.97 14.98 39.25 0 54.23-7.48 7.5-17.3 11.24-27.11 11.24z\" p-id=\"1416\"></path></svg>",
}
]));
}
}
}
//表格内部按钮事件
private void Table_base_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is User user)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new UserEdit(user) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
MaskClosable = true,
OnLoad = () =>
{
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
antList.Remove(user);
break;
case "AntdUI":
AntdUI.Message.info(window, user.CellLinks.FirstOrDefault().Id, autoClose: 1);
break;
}
}
}
private void ButtonDEL_Click(object sender, EventArgs e)
{
}
@ -73,7 +173,7 @@ namespace AntdUIDemo.Views
Selected = false,
Name = "张三",
Age = 30,
Address = "浙江省杭州市西湖区湖底公园1号",
Address = $"浙江省杭州市西湖区湖底公园{i + 1}号",
Enabled = i % 2 == 0,
//CellImages = [new CellImage(Properties.Resources.bg1)],
CellTags = [new CellTag("测试", TTypeMini.Primary), new CellTag("测试", TTypeMini.Success), new CellTag("测试", TTypeMini.Warn)],
@ -84,7 +184,7 @@ 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.Primary),
new CellButton(i.ToString(),"删除",TTypeMini.Error)],
//value:0-1
CellProgress = new CellProgress(0.5f),

189
Views/Test/TestDemo.Designer.cs generated Normal file
View File

@ -0,0 +1,189 @@
namespace AntdUIDemo.Views.Test
{
partial class TestDemo
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.flowPanel1 = new AntdUI.FlowPanel();
this.button1 = new AntdUI.Button();
this.button2 = new AntdUI.Button();
this.button3 = new AntdUI.Button();
this.button4 = new AntdUI.Button();
this.button5 = new AntdUI.Button();
this.button6 = new AntdUI.Button();
this.button7 = new AntdUI.Button();
this.button8 = new AntdUI.Button();
this.button9 = new AntdUI.Button();
this.button10 = new AntdUI.Button();
this.flowPanel1.SuspendLayout();
this.SuspendLayout();
//
// flowPanel1
//
this.flowPanel1.Controls.Add(this.button10);
this.flowPanel1.Controls.Add(this.button9);
this.flowPanel1.Controls.Add(this.button8);
this.flowPanel1.Controls.Add(this.button7);
this.flowPanel1.Controls.Add(this.button6);
this.flowPanel1.Controls.Add(this.button5);
this.flowPanel1.Controls.Add(this.button4);
this.flowPanel1.Controls.Add(this.button3);
this.flowPanel1.Controls.Add(this.button2);
this.flowPanel1.Controls.Add(this.button1);
this.flowPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowPanel1.Location = new System.Drawing.Point(0, 0);
this.flowPanel1.Name = "flowPanel1";
this.flowPanel1.Size = new System.Drawing.Size(500, 257);
this.flowPanel1.TabIndex = 0;
this.flowPanel1.Text = "flowPanel1";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(13, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(114, 40);
this.button1.TabIndex = 0;
this.button1.Text = "Button";
this.button1.Type = AntdUI.TTypeMini.Primary;
//
// button2
//
this.button2.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(133, 3);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(114, 40);
this.button2.TabIndex = 1;
this.button2.Text = "Button";
this.button2.Type = AntdUI.TTypeMini.Primary;
//
// button3
//
this.button3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.Location = new System.Drawing.Point(253, 3);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(114, 40);
this.button3.TabIndex = 2;
this.button3.Text = "Button";
this.button3.Type = AntdUI.TTypeMini.Primary;
//
// button4
//
this.button4.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button4.Location = new System.Drawing.Point(373, 3);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(114, 40);
this.button4.TabIndex = 3;
this.button4.Text = "Button";
this.button4.Type = AntdUI.TTypeMini.Primary;
//
// button5
//
this.button5.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button5.Location = new System.Drawing.Point(13, 49);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(114, 40);
this.button5.TabIndex = 4;
this.button5.Text = "Button";
this.button5.Type = AntdUI.TTypeMini.Primary;
//
// button6
//
this.button6.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button6.Location = new System.Drawing.Point(133, 49);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(114, 40);
this.button6.TabIndex = 5;
this.button6.Text = "Button";
this.button6.Type = AntdUI.TTypeMini.Primary;
//
// button7
//
this.button7.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button7.Location = new System.Drawing.Point(253, 49);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(114, 40);
this.button7.TabIndex = 6;
this.button7.Text = "Button";
this.button7.Type = AntdUI.TTypeMini.Primary;
//
// button8
//
this.button8.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button8.Location = new System.Drawing.Point(373, 49);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(114, 40);
this.button8.TabIndex = 7;
this.button8.Text = "Button";
this.button8.Type = AntdUI.TTypeMini.Primary;
//
// button9
//
this.button9.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button9.Location = new System.Drawing.Point(13, 95);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(114, 40);
this.button9.TabIndex = 8;
this.button9.Text = "Button";
this.button9.Type = AntdUI.TTypeMini.Primary;
//
// button10
//
this.button10.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button10.Location = new System.Drawing.Point(133, 95);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(114, 40);
this.button10.TabIndex = 9;
this.button10.Text = "Button";
this.button10.Type = AntdUI.TTypeMini.Primary;
//
// TestDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.flowPanel1);
this.Name = "TestDemo";
this.Size = new System.Drawing.Size(500, 257);
this.flowPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private AntdUI.FlowPanel flowPanel1;
private AntdUI.Button button4;
private AntdUI.Button button3;
private AntdUI.Button button2;
private AntdUI.Button button1;
private AntdUI.Button button10;
private AntdUI.Button button9;
private AntdUI.Button button8;
private AntdUI.Button button7;
private AntdUI.Button button6;
private AntdUI.Button button5;
}
}

20
Views/Test/TestDemo.cs Normal file
View File

@ -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.Test
{
public partial class TestDemo : UserControl
{
public TestDemo()
{
InitializeComponent();
}
}
}

120
Views/Test/TestDemo.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>