🦄 Beautiful AntdUI

pull/31/head
Tom 3 days ago
parent 1ad5fc66a5
commit 35c5d804e3

@ -46,8 +46,7 @@ namespace Demo.Controls
/// </summary>
private void InitializeComponent()
{
pageHeader1 = new AntdUI.PageHeader();
stackPanel1 = new AntdUI.StackPanel();
header1 = new AntdUI.PageHeader();
label1 = new AntdUI.Label();
input1 = new AntdUI.Input();
gridPanel1 = new AntdUI.GridPanel();
@ -57,51 +56,43 @@ namespace Demo.Controls
button3 = new AntdUI.Button();
button2 = new AntdUI.Button();
button1 = new AntdUI.Button();
stackPanel1.SuspendLayout();
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
gridPanel1.SuspendLayout();
tableLayoutPanel1.SuspendLayout();
SuspendLayout();
//
// pageHeader1
//
pageHeader1.Description = "精准划分区域的格栅布局容器。";
pageHeader1.Dock = System.Windows.Forms.DockStyle.Top;
pageHeader1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
pageHeader1.LocalizationDescription = "GridPanel.Description";
pageHeader1.LocalizationText = "GridPanel.Text";
pageHeader1.Location = new System.Drawing.Point(0, 0);
pageHeader1.Name = "pageHeader1";
pageHeader1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
pageHeader1.Size = new System.Drawing.Size(1000, 75);
pageHeader1.TabIndex = 0;
pageHeader1.Text = "GridPanel 格栅布局";
pageHeader1.UseTitleFont = true;
//
// stackPanel1
//
stackPanel1.Controls.Add(label1);
stackPanel1.Controls.Add(input1);
stackPanel1.Dock = System.Windows.Forms.DockStyle.Top;
stackPanel1.Location = new System.Drawing.Point(0, 75);
stackPanel1.Name = "stackPanel1";
stackPanel1.Size = new System.Drawing.Size(1000, 72);
stackPanel1.TabIndex = 1;
stackPanel1.Text = "stackPanel1";
// header1
//
header1.Description = "精准划分区域的格栅布局容器。";
header1.Dock = System.Windows.Forms.DockStyle.Top;
header1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
header1.LocalizationDescription = "GridPanel.Description";
header1.LocalizationText = "GridPanel.Text";
header1.Location = new System.Drawing.Point(0, 0);
header1.Name = "header1";
header1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
header1.Size = new System.Drawing.Size(1000, 75);
header1.TabIndex = 0;
header1.Text = "GridPanel 格栅布局";
header1.UseTitleFont = true;
//
// label1
//
label1.Location = new System.Drawing.Point(530, 3);
label1.Dock = System.Windows.Forms.DockStyle.Fill;
label1.Location = new System.Drawing.Point(503, 3);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(698, 66);
label1.Size = new System.Drawing.Size(494, 60);
label1.TabIndex = 1;
label1.Text = "以-为分解。-前为列宽属性,-后为行高属性列宽以;分组。每一组代表一行\r\n行高属性个数要与行数对应,每个数之间用空格间隔";
//
// input1
//
input1.Dock = System.Windows.Forms.DockStyle.Fill;
input1.Location = new System.Drawing.Point(3, 3);
input1.Multiline = true;
input1.Name = "input1";
input1.PrefixText = "Span属性";
input1.Size = new System.Drawing.Size(521, 66);
input1.Size = new System.Drawing.Size(494, 60);
input1.SuffixText = "";
input1.TabIndex = 0;
input1.Text = "10% 20%;20% 20%;30% 50%;-50% 10% 10%";
@ -116,91 +107,97 @@ namespace Demo.Controls
gridPanel1.Controls.Add(button2);
gridPanel1.Controls.Add(button1);
gridPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
gridPanel1.Location = new System.Drawing.Point(0, 147);
gridPanel1.Location = new System.Drawing.Point(0, 141);
gridPanel1.Name = "gridPanel1";
gridPanel1.Size = new System.Drawing.Size(1000, 653);
gridPanel1.Size = new System.Drawing.Size(1000, 659);
gridPanel1.Span = "10% 20%;20% 20%;30% 50%";
gridPanel1.TabIndex = 2;
gridPanel1.Text = "gridPanel1";
//
// button6
//
button6.BackExtend = "135, #6253E1, #04BEFE";
button6.Location = new System.Drawing.Point(303, 437);
button6.Location = new System.Drawing.Point(303, 441);
button6.Name = "button6";
button6.Size = new System.Drawing.Size(494, 211);
button6.Size = new System.Drawing.Size(494, 213);
button6.TabIndex = 5;
button6.Text = "button6";
button6.Text = "Button6";
button6.Type = AntdUI.TTypeMini.Primary;
//
// button5
//
button5.BackExtend = "135, #6253E1, #04BEFE";
button5.Location = new System.Drawing.Point(3, 437);
button5.Location = new System.Drawing.Point(3, 441);
button5.Name = "button5";
button5.Size = new System.Drawing.Size(294, 211);
button5.Size = new System.Drawing.Size(294, 213);
button5.TabIndex = 4;
button5.Text = "button5";
button5.Text = "Button5";
button5.Type = AntdUI.TTypeMini.Primary;
//
// button4
//
button4.BackExtend = "135, #6253E1, #04BEFE";
button4.Location = new System.Drawing.Point(203, 220);
button4.Location = new System.Drawing.Point(203, 222);
button4.Name = "button4";
button4.Size = new System.Drawing.Size(194, 211);
button4.Size = new System.Drawing.Size(194, 213);
button4.TabIndex = 3;
button4.Text = "button4";
button4.Text = "Button4";
button4.Type = AntdUI.TTypeMini.Primary;
//
// button3
//
button3.BackExtend = "135, #6253E1, #04BEFE";
button3.Location = new System.Drawing.Point(3, 220);
button3.Location = new System.Drawing.Point(3, 222);
button3.Name = "button3";
button3.Size = new System.Drawing.Size(194, 211);
button3.Size = new System.Drawing.Size(194, 213);
button3.TabIndex = 2;
button3.Text = "button3";
button3.Text = "Button3";
button3.Type = AntdUI.TTypeMini.Primary;
//
// button2
//
button2.BackExtend = "135, #6253E1, #04BEFE";
button2.Location = new System.Drawing.Point(103, 3);
button2.Name = "button2";
button2.Size = new System.Drawing.Size(194, 211);
button2.Size = new System.Drawing.Size(194, 213);
button2.TabIndex = 1;
button2.Text = "button2";
button2.Text = "Button2";
button2.Type = AntdUI.TTypeMini.Primary;
//
// button1
//
button1.BackExtend = "135, #6253E1, #04BEFE";
button1.Location = new System.Drawing.Point(3, 3);
button1.Name = "button1";
button1.Size = new System.Drawing.Size(94, 211);
button1.Size = new System.Drawing.Size(94, 213);
button1.TabIndex = 0;
button1.Text = "button1";
button1.Text = "Button1";
button1.Type = AntdUI.TTypeMini.Primary;
//
// tableLayoutPanel1
//
tableLayoutPanel1.ColumnCount = 2;
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
tableLayoutPanel1.Controls.Add(label1, 1, 0);
tableLayoutPanel1.Controls.Add(input1, 0, 0);
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
tableLayoutPanel1.Location = new System.Drawing.Point(0, 75);
tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.RowCount = 1;
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
tableLayoutPanel1.Size = new System.Drawing.Size(1000, 66);
tableLayoutPanel1.TabIndex = 1;
//
// GridPanel
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
Controls.Add(gridPanel1);
Controls.Add(stackPanel1);
Controls.Add(pageHeader1);
Controls.Add(tableLayoutPanel1);
Controls.Add(header1);
Name = "GridPanel";
Size = new System.Drawing.Size(1000, 800);
stackPanel1.ResumeLayout(false);
gridPanel1.ResumeLayout(false);
tableLayoutPanel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.PageHeader pageHeader1;
private AntdUI.StackPanel stackPanel1;
private AntdUI.PageHeader header1;
private AntdUI.Input input1;
private AntdUI.Label label1;
private AntdUI.GridPanel gridPanel1;
@ -210,5 +207,6 @@ namespace Demo.Controls
private AntdUI.Button button1;
private AntdUI.Button button6;
private AntdUI.Button button5;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}

@ -16,38 +16,21 @@
// CSDN: https://blog.csdn.net/v_132
// QQ: 17379620
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 Demo.Controls
{
public partial class GridPanel : UserControl
{
private Window window;
public GridPanel()
Form form;
public GridPanel(Form _form)
{
form = _form;
InitializeComponent();
gridPanel1.Span = input1.Text.Trim();
}
public GridPanel(Window _window) : this()
{
window = _window;
}
private void input1_TextChanged(object sender, EventArgs e)
{
gridPanel1.Span = input1.Text.Trim();
}
private void input1_TextChanged(object sender, EventArgs e) => gridPanel1.Span = input1.Text.Trim();
}
}

@ -101,7 +101,6 @@ namespace Demo.Controls
//
// progress1
//
progress1.ContainerControl = this;
progress1.Dock = DockStyle.Top;
progress1.Location = new Point(0, 28);
progress1.Name = "progress1";
@ -132,7 +131,6 @@ namespace Demo.Controls
//
// progress8
//
progress8.ContainerControl = this;
progress8.Dock = DockStyle.Top;
progress8.Font = new Font("Microsoft YaHei UI", 8F);
progress8.Location = new Point(0, 236);
@ -145,7 +143,6 @@ namespace Demo.Controls
//
// progress9
//
progress9.ContainerControl = this;
progress9.Dock = DockStyle.Top;
progress9.Font = new Font("Microsoft YaHei UI", 8F);
progress9.Location = new Point(0, 216);
@ -158,7 +155,6 @@ namespace Demo.Controls
//
// progress10
//
progress10.ContainerControl = this;
progress10.Dock = DockStyle.Top;
progress10.Font = new Font("Microsoft YaHei UI", 8F);
progress10.Loading = true;
@ -171,7 +167,6 @@ namespace Demo.Controls
//
// progress11
//
progress11.ContainerControl = this;
progress11.Dock = DockStyle.Top;
progress11.Font = new Font("Microsoft YaHei UI", 8F);
progress11.Location = new Point(0, 176);
@ -195,7 +190,6 @@ namespace Demo.Controls
//
// progress4
//
progress4.ContainerControl = this;
progress4.Dock = DockStyle.Top;
progress4.Location = new Point(0, 118);
progress4.Name = "progress4";
@ -207,7 +201,6 @@ namespace Demo.Controls
//
// progress3
//
progress3.ContainerControl = this;
progress3.Dock = DockStyle.Top;
progress3.Location = new Point(0, 88);
progress3.Name = "progress3";
@ -219,7 +212,6 @@ namespace Demo.Controls
//
// progress2
//
progress2.ContainerControl = this;
progress2.Dock = DockStyle.Top;
progress2.Loading = true;
progress2.Location = new Point(0, 58);
@ -299,7 +291,6 @@ namespace Demo.Controls
//
// progress15
//
progress15.ContainerControl = this;
progress15.Dock = DockStyle.Top;
progress15.Location = new Point(0, 334);
progress15.Name = "progress15";
@ -314,7 +305,6 @@ namespace Demo.Controls
//
// progress16
//
progress16.ContainerControl = this;
progress16.Dock = DockStyle.Top;
progress16.Location = new Point(0, 304);
progress16.Name = "progress16";
@ -327,7 +317,6 @@ namespace Demo.Controls
//
// progress17
//
progress17.ContainerControl = this;
progress17.Dock = DockStyle.Top;
progress17.Location = new Point(0, 274);
progress17.Name = "progress17";

@ -355,7 +355,6 @@ namespace Demo
//
// progress1
//
progress1.ContainerControl = this;
progress1.Loading = true;
progress1.Location = new Point(40, 332);
progress1.Name = "progress1";
@ -366,7 +365,6 @@ namespace Demo
//
// progress2
//
progress2.ContainerControl = this;
progress2.Location = new Point(40, 378);
progress2.Name = "progress2";
progress2.Size = new Size(480, 30);
@ -376,7 +374,6 @@ namespace Demo
//
// progress3
//
progress3.ContainerControl = this;
progress3.Location = new Point(40, 424);
progress3.Name = "progress3";
progress3.Size = new Size(480, 30);
@ -387,7 +384,6 @@ namespace Demo
//
// progress4
//
progress4.ContainerControl = this;
progress4.Font = new Font("Microsoft YaHei UI Light", 16F);
progress4.Loading = true;
progress4.Location = new Point(42, 488);
@ -401,7 +397,6 @@ namespace Demo
//
// progress5
//
progress5.ContainerControl = this;
progress5.Font = new Font("Microsoft YaHei UI Light", 16F);
progress5.Location = new Point(201, 488);
progress5.Name = "progress5";
@ -414,7 +409,6 @@ namespace Demo
//
// progress6
//
progress6.ContainerControl = this;
progress6.Font = new Font("Microsoft YaHei UI Light", 16F);
progress6.Location = new Point(360, 488);
progress6.Name = "progress6";
@ -429,7 +423,6 @@ namespace Demo
// progress7
//
progress7.Back = Color.FromArgb(40, 22, 119, 255);
progress7.ContainerControl = this;
progress7.Location = new Point(42, 622);
progress7.Name = "progress7";
progress7.Radius = 4;
@ -444,7 +437,6 @@ namespace Demo
// progress8
//
progress8.Back = Color.FromArgb(40, 0, 204, 0);
progress8.ContainerControl = this;
progress8.Location = new Point(201, 622);
progress8.Name = "progress8";
progress8.Radius = 4;
@ -459,7 +451,6 @@ namespace Demo
// progress9
//
progress9.Back = Color.FromArgb(40, 255, 79, 87);
progress9.ContainerControl = this;
progress9.Location = new Point(360, 622);
progress9.Name = "progress9";
progress9.Radius = 4;

Binary file not shown.

@ -186,6 +186,15 @@ namespace Demo {
}
}
/// <summary>
/// 查找类似 &lt;svg viewBox=&quot;0 0 156 104&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;&lt;g id=&quot;组件骨架图更新&quot; stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;&lt;g id=&quot;🎉-5.0-新版---黑&quot; transform=&quot;translate(-540.000000, -775.000000)&quot;&gt;&lt;g id=&quot;Grid&quot; transform=&quot;translate(541.000000, 775.500000)&quot;&gt;&lt;rect id=&quot;矩形&quot; fill=&quot;#001D66&quot; x=&quot;9.8333333&quot; y=&quot;15.5&quot; width=&quot;93&quot; height=&quot;72&quot;&gt;&lt;/rect&gt;&lt;rect id=&quot;矩形复制-38&quot; fill=&quot;#001D66&quot; x=&quot;113.166667&quot; y=&quot;15.5&quot; width=&quot;31&quot; height=&quot;72&quot;&gt;&lt;/rect&gt;&lt;g id=&quot;编组-27&quot;&gt;&lt;rect id=&quot;矩形&quot; fill-opacity=&quot;0.15&quot; fill=&quot;#FFFFFF&quot; f [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Grid {
get {
return ResourceManager.GetString("Grid", resourceCulture);
}
}
/// <summary>
/// 查找类似 &lt;svg viewBox=&quot;0 0 112 32&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;&lt;g id=&quot;组件骨架图更新&quot; stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;&lt;g id=&quot;🎉-5.0-新版---黑&quot; transform=&quot;translate(-562.000000, -463.000000)&quot;&gt;&lt;g id=&quot;Icon&quot; transform=&quot;translate(562.000000, 463.000000)&quot;&gt;&lt;g id=&quot;smile-fill&quot;&gt;&lt;rect id=&quot;矩形&quot; fill=&quot;#000000&quot; fill-rule=&quot;nonzero&quot; opacity=&quot;0&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;32&quot; height=&quot;32&quot;&gt;&lt;/rect&gt;&lt;path d=&quot;M16,2 C8.26875,2 2,8.26875 2,16 C2,23.73125 8.26875,30 16,30 C23.73125,30 30,23.73125 30,16 C30,8.26875 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>

File diff suppressed because one or more lines are too long

@ -186,6 +186,15 @@ namespace Demo {
}
}
/// <summary>
/// 查找类似 &lt;svg xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; viewBox=&quot;0 0 156 104&quot;&gt;&lt;g id=&quot;组件骨架图更新&quot; stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;&lt;g id=&quot;🎉-5.0-新版&quot; transform=&quot;translate(-540.000000, -775.000000)&quot;&gt;&lt;g id=&quot;Grid&quot; transform=&quot;translate(541.000000, 775.000000)&quot;&gt;&lt;g id=&quot;编组-27&quot;&gt;&lt;rect id=&quot;矩形&quot; fill=&quot;#F5F5F5&quot; fill-rule=&quot;nonzero&quot; x=&quot;9.8333333&quot; y=&quot;0&quot; width=&quot;10.3333333&quot; height=&quot;104&quot;/&gt;&lt;rect id=&quot;矩形复制-9&quot; fill=&quot;#F5F5F5&quot; fill-rule=&quot;nonzero&quot; x=&quot;51.1666667&quot; y=&quot;0&quot; width=&quot;10.3333333&quot; height=&quot;104&quot;/&gt;&lt;rect id=&quot;矩形复制- [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Grid {
get {
return ResourceManager.GetString("Grid", resourceCulture);
}
}
/// <summary>
/// 查找类似 &lt;svg viewBox=&quot;0 0 112 32&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;&lt;g id=&quot;组件骨架图更新&quot; stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;&lt;g id=&quot;🎉-5.0-新版&quot; transform=&quot;translate(-562.000000, -463.000000)&quot;&gt;&lt;g id=&quot;Icon&quot; transform=&quot;translate(562.000000, 463.000000)&quot;&gt;&lt;g id=&quot;smile-fill&quot;&gt;&lt;rect id=&quot;矩形&quot; fill=&quot;#000000&quot; fill-rule=&quot;nonzero&quot; opacity=&quot;0&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;32&quot; height=&quot;32&quot;&gt;&lt;/rect&gt;&lt;path d=&quot;M16,2 C8.26875,2 2,8.26875 2,16 C2,23.73125 8.26875,30 16,30 C23.73125,30 30,23.73125 30,16 C30,8.26875 23.7 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>

File diff suppressed because one or more lines are too long

@ -41,7 +41,7 @@ namespace AntdUI
/// <summary>
/// 跨度
/// </summary>
[Description("跨度"), Category("外观"), DefaultValue("50% 50%;50% 50%-50% 50%")]
[Description("跨度"), Category("外观"), DefaultValue("50% 50%;50% 50%")]
[Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(UITypeEditor))]
public string Span
{
@ -104,7 +104,7 @@ namespace AntdUI
/// <summary>
/// 内容大小
/// </summary>
public string Span { get; set; } = "50% 50%;50% 50%-50% 50%";
public string Span { get; set; } = "50% 50%;50% 50%";
/// <summary>
/// 间距
@ -157,16 +157,14 @@ namespace AntdUI
foreach (string xaxis in abs)
{
var x = xaxis.Trim();
if (x.EndsWith("%") && float.TryParse(x.TrimEnd('%'), out var xF))
xObjTemp.Add(xF / 100F);
if (x.EndsWith("%") && float.TryParse(x.TrimEnd('%'), out var xF)) xObjTemp.Add(xF / 100F);
else if (int.TryParse(x, out var xi))
{
int uw = (int)Math.Round(xi * Config.Dpi);
xObjTemp.Add(uw);
use_width += uw;
}
else if (float.TryParse(x, out float xF2))
xObjTemp.Add(xF2);
else if (float.TryParse(x, out float xF2)) xObjTemp.Add(xF2);
}
int read_width = rect.Width - use_width;
@ -174,10 +172,8 @@ namespace AntdUI
foreach (var it in xObjTemp)
{
if (it is float f)
x_temp.Add((int)Math.Round(read_width * f));
else if (it is int i)
x_temp.Add(i);
if (it is float f) x_temp.Add((int)Math.Round(read_width * f));
else if (it is int i) x_temp.Add(i);
}
// 转换后实际行高
@ -194,48 +190,38 @@ namespace AntdUI
// 剩余行高
int read_height = rect.Height - use_height;
if (y.EndsWith("%") && float.TryParse(y.TrimEnd('%'), out var yF))
height = (int)Math.Round(read_height * (yF / 100F));
if (y.EndsWith("%") && float.TryParse(y.TrimEnd('%'), out var yF)) height = (int)Math.Round(read_height * (yF / 100F));
else if (int.TryParse(y, out var i))
{
int uh = (int)Math.Round(i * Config.Dpi);
height = uh;
use_height += uh;
}
else if (float.TryParse(y, out float yF2))
height = (int)Math.Round(read_height * yF2);
}
else
{
height = -999;
else if (float.TryParse(y, out float yF2)) height = (int)Math.Round(read_height * yF2);
}
else height = -999;
}
else
{
height = -999;
}
else height = -999;
if (x_temp.Count > 0)
{
data_count += x_temp.Count;
data.Add(x_temp, height);
}
}
}
}
if (data.Count > 0)
{
Rectangle[] rects;
if (data.Count == 1)
rects = new Rectangle[1] { rect };
if (data.Count == 1) rects = new Rectangle[1] { rect };
else
{
if (data.Count > 1)
{
var tmp_rects = new List<Rectangle>();
int hasx = 0, hasy = 0;
foreach (var item in data)
{
int y = item.Value == -999 ? rect.Height / data.Count : item.Value;

Loading…
Cancel
Save