添加Message, Modal, 完善Alert

This commit is contained in:
czz_y 2024-09-04 17:33:09 +08:00
parent 7f2ccb2ef8
commit accf2de921
9 changed files with 1065 additions and 24 deletions

View File

@ -227,7 +227,7 @@
this.select_colormode.Name = "select_colormode"; this.select_colormode.Name = "select_colormode";
this.select_colormode.SelectedIndex = 0; this.select_colormode.SelectedIndex = 0;
this.select_colormode.SelectedValue = "Auto"; this.select_colormode.SelectedValue = "Auto";
this.select_colormode.Size = new System.Drawing.Size(60, 26); this.select_colormode.Size = new System.Drawing.Size(65, 26);
this.select_colormode.TabIndex = 2; this.select_colormode.TabIndex = 2;
this.select_colormode.Text = "Auto"; this.select_colormode.Text = "Auto";
this.select_colormode.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.select_colormode.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;

View File

@ -268,9 +268,18 @@ namespace AntdUIDemo
case "Tree": case "Tree":
control = new TreeDemo(); control = new TreeDemo();
break; break;
case "Alert":
control = new AlertDemo();
break;
case "Drawer": case "Drawer":
control = new DrawerDemo(this); control = new DrawerDemo(this);
break; break;
case "Message":
control = new MessageDemo(this);
break;
case "Modal":
control = new ModalDemo(this);
break;
} }
if (control != null) if (control != null)
{ {

View File

@ -29,6 +29,8 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.stackPanel1 = new AntdUI.StackPanel(); this.stackPanel1 = new AntdUI.StackPanel();
this.alert9 = new AntdUI.Alert();
this.label6 = new AntdUI.Label();
this.flowPanel3 = new AntdUI.FlowPanel(); this.flowPanel3 = new AntdUI.FlowPanel();
this.alert12 = new AntdUI.Alert(); this.alert12 = new AntdUI.Alert();
this.label5 = new AntdUI.Label(); this.label5 = new AntdUI.Label();
@ -47,8 +49,6 @@
this.divider1 = new AntdUI.Divider(); this.divider1 = new AntdUI.Divider();
this.label2 = new AntdUI.Label(); this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label(); this.label1 = new AntdUI.Label();
this.label6 = new AntdUI.Label();
this.alert9 = new AntdUI.Alert();
this.stackPanel1.SuspendLayout(); this.stackPanel1.SuspendLayout();
this.flowPanel3.SuspendLayout(); this.flowPanel3.SuspendLayout();
this.flowPanel1.SuspendLayout(); this.flowPanel1.SuspendLayout();
@ -76,12 +76,32 @@
this.stackPanel1.Text = "stackPanel1"; this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true; this.stackPanel1.Vertical = true;
// //
// alert9
//
this.alert9.BackColor = System.Drawing.Color.Pink;
this.alert9.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.alert9.Location = new System.Drawing.Point(3, 381);
this.alert9.Loop = true;
this.alert9.Name = "alert9";
this.alert9.Size = new System.Drawing.Size(694, 32);
this.alert9.TabIndex = 45;
this.alert9.Text = "I can be a React component, multiple React components, or just some text.";
//
// 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(3, 351);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(694, 24);
this.label6.TabIndex = 44;
this.label6.Text = "轮播";
//
// flowPanel3 // flowPanel3
// //
this.flowPanel3.Controls.Add(this.alert12); this.flowPanel3.Controls.Add(this.alert12);
this.flowPanel3.Location = new System.Drawing.Point(3, 275); this.flowPanel3.Location = new System.Drawing.Point(3, 275);
this.flowPanel3.Name = "flowPanel3"; this.flowPanel3.Name = "flowPanel3";
this.flowPanel3.Size = new System.Drawing.Size(694, 76); this.flowPanel3.Size = new System.Drawing.Size(694, 70);
this.flowPanel3.TabIndex = 43; this.flowPanel3.TabIndex = 43;
this.flowPanel3.Text = "flowPanel3"; this.flowPanel3.Text = "flowPanel3";
// //
@ -92,7 +112,7 @@
this.alert12.Icon = AntdUI.TType.Success; this.alert12.Icon = AntdUI.TType.Success;
this.alert12.Location = new System.Drawing.Point(3, 3); this.alert12.Location = new System.Drawing.Point(3, 3);
this.alert12.Name = "alert12"; this.alert12.Name = "alert12";
this.alert12.Size = new System.Drawing.Size(498, 70); this.alert12.Size = new System.Drawing.Size(498, 59);
this.alert12.TabIndex = 0; this.alert12.TabIndex = 0;
this.alert12.Text = "Success Description Success Description Success Description"; this.alert12.Text = "Success Description Success Description Success Description";
this.alert12.TextTitle = "Success Text"; this.alert12.TextTitle = "Success Text";
@ -257,25 +277,6 @@
this.label1.TabIndex = 18; this.label1.TabIndex = 18;
this.label1.Text = "Alert 警告提示"; this.label1.Text = "Alert 警告提示";
// //
// 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(3, 357);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(694, 24);
this.label6.TabIndex = 44;
this.label6.Text = "轮播";
//
// alert9
//
this.alert9.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.alert9.Location = new System.Drawing.Point(3, 387);
this.alert9.Loop = true;
this.alert9.Name = "alert9";
this.alert9.Size = new System.Drawing.Size(694, 32);
this.alert9.TabIndex = 45;
this.alert9.Text = "I can be a React component, multiple React components, or just some text.";
//
// AlertDemo // AlertDemo
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;

265
Views/MessageDemo.Designer.cs generated Normal file
View File

@ -0,0 +1,265 @@
namespace AntdUIDemo.Views
{
partial class MessageDemo
{
/// <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.flowPanel1 = new AntdUI.FlowPanel();
this.button_i = new AntdUI.Button();
this.button_w = new AntdUI.Button();
this.button_e = new AntdUI.Button();
this.button_s = new AntdUI.Button();
this.label4 = new AntdUI.Label();
this.flowPanel2 = new AntdUI.FlowPanel();
this.button_info = new AntdUI.Button();
this.button_warn = new AntdUI.Button();
this.button_error = new AntdUI.Button();
this.button_sucess = new AntdUI.Button();
this.label3 = new AntdUI.Label();
this.divider1 = new AntdUI.Divider();
this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label();
this.stackPanel1.SuspendLayout();
this.flowPanel1.SuspendLayout();
this.flowPanel2.SuspendLayout();
this.SuspendLayout();
//
// stackPanel1
//
this.stackPanel1.Controls.Add(this.flowPanel1);
this.stackPanel1.Controls.Add(this.label4);
this.stackPanel1.Controls.Add(this.flowPanel2);
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, 360);
this.stackPanel1.TabIndex = 0;
this.stackPanel1.Text = "stackPanel1";
this.stackPanel1.Vertical = true;
//
// flowPanel1
//
this.flowPanel1.Controls.Add(this.button_i);
this.flowPanel1.Controls.Add(this.button_w);
this.flowPanel1.Controls.Add(this.button_e);
this.flowPanel1.Controls.Add(this.button_s);
this.flowPanel1.Location = new System.Drawing.Point(3, 201);
this.flowPanel1.Name = "flowPanel1";
this.flowPanel1.Size = new System.Drawing.Size(694, 38);
this.flowPanel1.TabIndex = 42;
this.flowPanel1.Text = "flowPanel1";
//
// button_i
//
this.button_i.BorderWidth = 2F;
this.button_i.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_i.Ghost = true;
this.button_i.Location = new System.Drawing.Point(261, 3);
this.button_i.Name = "button_i";
this.button_i.Size = new System.Drawing.Size(80, 32);
this.button_i.TabIndex = 5;
this.button_i.Text = "Info";
this.button_i.Type = AntdUI.TTypeMini.Info;
this.button_i.WaveSize = 0;
//
// button_w
//
this.button_w.BorderWidth = 2F;
this.button_w.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_w.Ghost = true;
this.button_w.Location = new System.Drawing.Point(175, 3);
this.button_w.Name = "button_w";
this.button_w.Size = new System.Drawing.Size(80, 32);
this.button_w.TabIndex = 4;
this.button_w.Text = "Warn";
this.button_w.Type = AntdUI.TTypeMini.Warn;
this.button_w.WaveSize = 0;
//
// button_e
//
this.button_e.BorderWidth = 2F;
this.button_e.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_e.Ghost = true;
this.button_e.Location = new System.Drawing.Point(89, 3);
this.button_e.Name = "button_e";
this.button_e.Size = new System.Drawing.Size(80, 32);
this.button_e.TabIndex = 3;
this.button_e.Text = "Error";
this.button_e.Type = AntdUI.TTypeMini.Error;
this.button_e.WaveSize = 0;
//
// button_s
//
this.button_s.BorderWidth = 2F;
this.button_s.Cursor = System.Windows.Forms.Cursors.Default;
this.button_s.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_s.Ghost = true;
this.button_s.Location = new System.Drawing.Point(3, 3);
this.button_s.Name = "button_s";
this.button_s.Size = new System.Drawing.Size(80, 32);
this.button_s.TabIndex = 2;
this.button_s.Text = "Success";
this.button_s.Type = AntdUI.TTypeMini.Success;
this.button_s.WaveSize = 0;
//
// 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, 171);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(694, 24);
this.label4.TabIndex = 41;
this.label4.Text = "延时用法";
//
// flowPanel2
//
this.flowPanel2.Controls.Add(this.button_info);
this.flowPanel2.Controls.Add(this.button_warn);
this.flowPanel2.Controls.Add(this.button_error);
this.flowPanel2.Controls.Add(this.button_sucess);
this.flowPanel2.Location = new System.Drawing.Point(3, 127);
this.flowPanel2.Name = "flowPanel2";
this.flowPanel2.Size = new System.Drawing.Size(694, 38);
this.flowPanel2.TabIndex = 40;
this.flowPanel2.Text = "flowPanel2";
//
// button_info
//
this.button_info.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_info.Location = new System.Drawing.Point(261, 3);
this.button_info.Name = "button_info";
this.button_info.Size = new System.Drawing.Size(80, 32);
this.button_info.TabIndex = 5;
this.button_info.Text = "Info";
this.button_info.Type = AntdUI.TTypeMini.Info;
this.button_info.WaveSize = 0;
//
// button_warn
//
this.button_warn.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_warn.Location = new System.Drawing.Point(175, 3);
this.button_warn.Name = "button_warn";
this.button_warn.Size = new System.Drawing.Size(80, 32);
this.button_warn.TabIndex = 4;
this.button_warn.Text = "Warn";
this.button_warn.Type = AntdUI.TTypeMini.Warn;
this.button_warn.WaveSize = 0;
//
// button_error
//
this.button_error.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_error.Location = new System.Drawing.Point(89, 3);
this.button_error.Name = "button_error";
this.button_error.Size = new System.Drawing.Size(80, 32);
this.button_error.TabIndex = 3;
this.button_error.Text = "Error";
this.button_error.Type = AntdUI.TTypeMini.Error;
this.button_error.WaveSize = 0;
//
// button_sucess
//
this.button_sucess.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_sucess.Location = new System.Drawing.Point(3, 3);
this.button_sucess.Name = "button_sucess";
this.button_sucess.Size = new System.Drawing.Size(80, 32);
this.button_sucess.TabIndex = 2;
this.button_sucess.Text = "Success";
this.button_sucess.Type = AntdUI.TTypeMini.Success;
this.button_sucess.WaveSize = 0;
//
// 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 = 25;
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 = 24;
//
// 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 = 23;
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 = 22;
this.label1.Text = "Message 全局提示";
//
// MessageDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.stackPanel1);
this.Name = "MessageDemo";
this.Size = new System.Drawing.Size(700, 360);
this.stackPanel1.ResumeLayout(false);
this.flowPanel1.ResumeLayout(false);
this.flowPanel2.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 flowPanel2;
private AntdUI.Button button_info;
private AntdUI.Button button_warn;
private AntdUI.Button button_error;
private AntdUI.Button button_sucess;
private AntdUI.FlowPanel flowPanel1;
private AntdUI.Button button_i;
private AntdUI.Button button_w;
private AntdUI.Button button_e;
private AntdUI.Button button_s;
private AntdUI.Label label4;
}
}

121
Views/MessageDemo.cs Normal file
View File

@ -0,0 +1,121 @@
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
{
public partial class MessageDemo : UserControl
{
private AntdUI.Window window;
public MessageDemo(AntdUI.Window _window)
{
window = _window;
InitializeComponent();
BindEventHandler();
}
private void BindEventHandler()
{
button_sucess.Click += Button_Click;
button_error.Click += Button_Click;
button_info.Click += Button_Click;
button_warn.Click += Button_Click;
button_e.Click += Button_loading_Click;
button_i.Click += Button_loading_Click;
button_w.Click += Button_loading_Click;
button_s.Click += Button_loading_Click;
}
private void Button_loading_Click(object sender, EventArgs e)
{
var button = sender as AntdUI.Button;
button.Loading = true;
var text = button.Text;
switch (text)
{
case "Success":
AntdUI.Message.loading(window, "加载中...", call: (config) =>
{
//执行一些耗时操作,暂不支持异步任务
Thread.Sleep(2000);
config.Text = "加载配置...";
config.Refresh();
Thread.Sleep(2000);
config.OK("加载成功");
//恢复按钮加载状态
button.Loading = false;
}, autoClose: 1);
break;
case "Error":
AntdUI.Message.loading(window, "加载中...", call: (config) =>
{
//执行一些耗时操作,暂不支持异步任务
Thread.Sleep(2000);
config.Text = "加载配置...";
config.Refresh();
Thread.Sleep(2000);
config.Error("加载失败");
//恢复按钮加载状态
button.Loading = false;
}, autoClose: 1);
break;
case "Info":
AntdUI.Message.loading(window, "加载中...", call: (config) =>
{
//执行一些耗时操作,暂不支持异步任务
Thread.Sleep(2000);
config.Text = "加载配置...";
config.Refresh();
Thread.Sleep(2000);
config.Info("加载提示");
//恢复按钮加载状态
button.Loading = false;
}, autoClose: 1);
break;
case "Warn":
AntdUI.Message.loading(window, "加载中...", call: (config) =>
{
//执行一些耗时操作,暂不支持异步任务
Thread.Sleep(2000);
config.Text = "加载配置...";
config.Refresh();
Thread.Sleep(2000);
config.Warn("加载警告");
//恢复按钮加载状态
button.Loading = false;
}, autoClose: 1);
break;
}
}
private void Button_Click(object sender, EventArgs e)
{
var button = sender as AntdUI.Button;
var text = button.Text;
switch (text)
{
//autoClose: 0 不自动关闭, 单位为秒
case "Success":
AntdUI.Message.success(window, "This is a success message", autoClose: 1);
break;
case "Error":
AntdUI.Message.error(window, "This is an error message", autoClose: 1);
break;
case "Info":
AntdUI.Message.info(window, "This is an info message", autoClose: 1);
break;
case "Warn":
AntdUI.Message.warn(window, "This is a warn message", autoClose: 1);
break;
}
}
}
}

120
Views/MessageDemo.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>

292
Views/ModalDemo.Designer.cs generated Normal file
View File

@ -0,0 +1,292 @@
namespace AntdUIDemo.Views
{
partial class ModalDemo
{
/// <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.flowPanel2 = new AntdUI.FlowPanel();
this.button_base = new AntdUI.Button();
this.label4 = new AntdUI.Label();
this.flowPanel1 = new AntdUI.FlowPanel();
this.button_nobutton = new AntdUI.Button();
this.button_custombutton = new AntdUI.Button();
this.label5 = new AntdUI.Label();
this.flowPanel3 = new AntdUI.FlowPanel();
this.button_nomask = new AntdUI.Button();
this.button_noclose = new AntdUI.Button();
this.button_close = new AntdUI.Button();
this.label6 = new AntdUI.Label();
this.flowPanel4 = new AntdUI.FlowPanel();
this.button_sys = new AntdUI.Button();
this.stackPanel1.SuspendLayout();
this.flowPanel2.SuspendLayout();
this.flowPanel1.SuspendLayout();
this.flowPanel3.SuspendLayout();
this.flowPanel4.SuspendLayout();
this.SuspendLayout();
//
// stackPanel1
//
this.stackPanel1.Controls.Add(this.flowPanel4);
this.stackPanel1.Controls.Add(this.label6);
this.stackPanel1.Controls.Add(this.flowPanel3);
this.stackPanel1.Controls.Add(this.label5);
this.stackPanel1.Controls.Add(this.flowPanel1);
this.stackPanel1.Controls.Add(this.label4);
this.stackPanel1.Controls.Add(this.flowPanel2);
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, 475);
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 = 29;
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 = 28;
//
// 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 = 27;
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 = 26;
this.label1.Text = "Modal 对话框";
//
// flowPanel2
//
this.flowPanel2.Controls.Add(this.button_base);
this.flowPanel2.Location = new System.Drawing.Point(3, 127);
this.flowPanel2.Name = "flowPanel2";
this.flowPanel2.Size = new System.Drawing.Size(694, 38);
this.flowPanel2.TabIndex = 41;
this.flowPanel2.Text = "flowPanel2";
//
// button_base
//
this.button_base.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_base.Location = new System.Drawing.Point(3, 3);
this.button_base.Name = "button_base";
this.button_base.Size = new System.Drawing.Size(90, 32);
this.button_base.TabIndex = 3;
this.button_base.Text = "Open Modal";
this.button_base.Type = AntdUI.TTypeMini.Primary;
this.button_base.WaveSize = 0;
//
// 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, 171);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(694, 24);
this.label4.TabIndex = 42;
this.label4.Text = "自定义页脚";
//
// flowPanel1
//
this.flowPanel1.Controls.Add(this.button_custombutton);
this.flowPanel1.Controls.Add(this.button_nobutton);
this.flowPanel1.Location = new System.Drawing.Point(3, 201);
this.flowPanel1.Name = "flowPanel1";
this.flowPanel1.Size = new System.Drawing.Size(694, 38);
this.flowPanel1.TabIndex = 43;
this.flowPanel1.Text = "flowPanel1";
//
// button_nobutton
//
this.button_nobutton.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_nobutton.Location = new System.Drawing.Point(3, 3);
this.button_nobutton.Name = "button_nobutton";
this.button_nobutton.Size = new System.Drawing.Size(90, 32);
this.button_nobutton.TabIndex = 3;
this.button_nobutton.Text = "无按钮";
this.button_nobutton.Type = AntdUI.TTypeMini.Primary;
this.button_nobutton.WaveSize = 0;
//
// button_custombutton
//
this.button_custombutton.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_custombutton.Location = new System.Drawing.Point(99, 3);
this.button_custombutton.Name = "button_custombutton";
this.button_custombutton.Size = new System.Drawing.Size(90, 32);
this.button_custombutton.TabIndex = 4;
this.button_custombutton.Text = "自定义按钮";
this.button_custombutton.Type = AntdUI.TTypeMini.Primary;
this.button_custombutton.WaveSize = 0;
//
// label5
//
this.label5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(3, 245);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(694, 24);
this.label5.TabIndex = 44;
this.label5.Text = "遮罩";
//
// flowPanel3
//
this.flowPanel3.Controls.Add(this.button_close);
this.flowPanel3.Controls.Add(this.button_noclose);
this.flowPanel3.Controls.Add(this.button_nomask);
this.flowPanel3.Location = new System.Drawing.Point(3, 275);
this.flowPanel3.Name = "flowPanel3";
this.flowPanel3.Size = new System.Drawing.Size(694, 38);
this.flowPanel3.TabIndex = 45;
this.flowPanel3.Text = "flowPanel3";
//
// button_nomask
//
this.button_nomask.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_nomask.Location = new System.Drawing.Point(3, 3);
this.button_nomask.Name = "button_nomask";
this.button_nomask.Size = new System.Drawing.Size(90, 32);
this.button_nomask.TabIndex = 3;
this.button_nomask.Text = "无遮罩";
this.button_nomask.Type = AntdUI.TTypeMini.Primary;
this.button_nomask.WaveSize = 0;
//
// button_noclose
//
this.button_noclose.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_noclose.Location = new System.Drawing.Point(99, 3);
this.button_noclose.Name = "button_noclose";
this.button_noclose.Size = new System.Drawing.Size(90, 32);
this.button_noclose.TabIndex = 4;
this.button_noclose.Text = "外侧禁止关闭";
this.button_noclose.Type = AntdUI.TTypeMini.Primary;
this.button_noclose.WaveSize = 0;
//
// button_close
//
this.button_close.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_close.Location = new System.Drawing.Point(195, 3);
this.button_close.Name = "button_close";
this.button_close.Size = new System.Drawing.Size(90, 32);
this.button_close.TabIndex = 5;
this.button_close.Text = "关闭按钮";
this.button_close.Type = AntdUI.TTypeMini.Primary;
this.button_close.WaveSize = 0;
//
// 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(3, 319);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(694, 24);
this.label6.TabIndex = 46;
this.label6.Text = "自定义弹窗";
//
// flowPanel4
//
this.flowPanel4.Controls.Add(this.button_sys);
this.flowPanel4.Location = new System.Drawing.Point(3, 349);
this.flowPanel4.Name = "flowPanel4";
this.flowPanel4.Size = new System.Drawing.Size(694, 38);
this.flowPanel4.TabIndex = 47;
this.flowPanel4.Text = "flowPanel4";
//
// button_sys
//
this.button_sys.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button_sys.Location = new System.Drawing.Point(3, 3);
this.button_sys.Name = "button_sys";
this.button_sys.Size = new System.Drawing.Size(90, 32);
this.button_sys.TabIndex = 3;
this.button_sys.Text = "系统设置";
this.button_sys.Type = AntdUI.TTypeMini.Primary;
this.button_sys.WaveSize = 0;
//
// ModalDemo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.stackPanel1);
this.Name = "ModalDemo";
this.Size = new System.Drawing.Size(700, 475);
this.stackPanel1.ResumeLayout(false);
this.flowPanel2.ResumeLayout(false);
this.flowPanel1.ResumeLayout(false);
this.flowPanel3.ResumeLayout(false);
this.flowPanel4.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 flowPanel2;
private AntdUI.Button button_base;
private AntdUI.Label label4;
private AntdUI.FlowPanel flowPanel1;
private AntdUI.Button button_nobutton;
private AntdUI.Button button_custombutton;
private AntdUI.FlowPanel flowPanel3;
private AntdUI.Button button_nomask;
private AntdUI.Label label5;
private AntdUI.Button button_noclose;
private AntdUI.Button button_close;
private AntdUI.FlowPanel flowPanel4;
private AntdUI.Button button_sys;
private AntdUI.Label label6;
}
}

113
Views/ModalDemo.cs Normal file
View File

@ -0,0 +1,113 @@
using AntdUI;
using AntdUIDemo.Controls;
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
{
public partial class ModalDemo : UserControl
{
private AntdUI.Window window;
public ModalDemo(AntdUI.Window _window)
{
window = _window;
InitializeComponent();
BindEventHandler();
}
private void BindEventHandler()
{
button_base.Click += Button_base_Click;
button_nobutton.Click += Button_nobutton_Click;
button_custombutton.Click += Button_custombutton_Click;
button_nomask.Click += Button_nomask_Click;
button_noclose.Click += Button_noclose_Click;
button_close.Click += Button_close_Click;
button_sys.Click += Button_sys_Click;
}
private void Button_sys_Click(object sender, EventArgs e)
{
using (var form = new SystemSet(window))
{
//AutoDpi(form);
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "系统设置", form, TType.Info)
{
CloseIcon = true,
BtnHeight = 0,
Keyboard = false,
MaskClosable = false,
});
}
}
private void Button_close_Click(object sender, EventArgs e)
{
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
CloseIcon = true,
});
}
private void Button_noclose_Click(object sender, EventArgs e)
{
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
MaskClosable = false,
});
}
private void Button_nomask_Click(object sender, EventArgs e)
{
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
Mask = false,
});
}
private void Button_custombutton_Click(object sender, EventArgs e)
{
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
Btns = [new AntdUI.Modal.Btn("return", "Return", AntdUI.TTypeMini.Default),
new AntdUI.Modal.Btn("submit", "Submit", AntdUI.TTypeMini.Warn)],
CancelText = null,
OkText = "Search On Google",
OnOk = config =>
{
//执行耗时操作,仅OK按钮支持异步响应
Thread.Sleep(2000);
return true;
},
OnBtns = button =>
{
AntdUI.Message.info(window, button.Text, autoClose: 1);
}
});
}
private void Button_nobutton_Click(object sender, EventArgs e)
{
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
BtnHeight = 0,
});
}
private void Button_base_Click(object sender, EventArgs e)
{
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "Basic Modal", "Some contents...\r\nSome contents...\r\nSome contents...")
{
Icon = TType.Info,
});
}
}
}

120
Views/ModalDemo.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>