🌵 Add Shield

This commit is contained in:
Tom
2025-06-23 15:36:36 +08:00
parent 8ff264f9a2
commit 07d49947c4
16 changed files with 597 additions and 158 deletions

View File

@@ -109,9 +109,10 @@ Ant Design for WinForms, reimagines desktop app aesthetics with modern frontend
➡️| **MsgList** Friend message list | ✅ | ❎ |
➡️| **ChatList** Chat bubble list | ✅ | ❎ |
||||
⬇️| Other `4` | Animation | Disable |
⬇️| Other `5` | Animation | Disable |
➡️| [**Battery**](doc/wiki/en/Control/Battery.md) | ✅ | ❎ |
➡️| [**Signal**](doc/wiki/en/Control/Signal.md) | ✅ | ❎ |
➡️| [**Shield**](doc/wiki/en/Control/Shield.md) | ❎ | ❎ |
➡️| [**ContextMenuStrip**](doc/wiki/en/Control/ContextMenuStrip.md) | ✅ | ❎ |
➡️| **Image3D** | ✅ | ❎ |

View File

@@ -5,7 +5,7 @@
<h1>AntdUI</h1>
[![NuGet](https://img.shields.io/nuget/v/AntdUI.svg?style=flat-square&label=AntdUI&logo=nuget)](https://www.nuget.org/packages/AntdUI)
[![QQGroup](https://img.shields.io/badge/QQ群-328884096-f74658?style=flat-square&logo=tencentqq)](https://qm.qq.com/cgi-bin/qm/qr?k=ZfuHy4LqYC57DYTWAUWkQD9EjdVfvx3y&jump_from=webapi&authKey=4sAgZN0XlFHx+4MW9PdkiGgg435QfKcQdu5lKi1Fp4PP0O+DL6NaKAcV8ybCLM97)
[![QQGroup](https://img.shields.io/badge/QQ群-328884096-f74658?style=flat-square&logo=qq)](https://qm.qq.com/cgi-bin/qm/qr?k=ZfuHy4LqYC57DYTWAUWkQD9EjdVfvx3y&jump_from=webapi&authKey=4sAgZN0XlFHx+4MW9PdkiGgg435QfKcQdu5lKi1Fp4PP0O+DL6NaKAcV8ybCLM97)
[![Download](https://img.shields.io/nuget/dt/antdui?style=flat-square)](https://www.nuget.org/packages/AntdUI)
[![AntDesign](https://img.shields.io/badge/AntDesign%20-5.0-1677ff?style=flat-square&logo=antdesign)](https://ant-design.antgroup.com/components/overview-cn)
[![License](https://img.shields.io/badge/license-Apache%202.0-4EB1BA.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0)
@@ -111,9 +111,10 @@
➡️| **MsgList** 好友消息列表 | ✅ | ❎ |
➡️| **ChatList** 气泡聊天列表 | ✅ | ❎ |
||||
⬇️| 其他 `4` | 动画 | 禁用 |
⬇️| 其他 `5` | 动画 | 禁用 |
➡️| [**Battery** 电量](doc/wiki/zh/Control/Battery.md) | ✅ | ❎ |
➡️| [**Signal** 信号强度](doc/wiki/zh/Control/Signal.md) | ✅ | ❎ |
➡️| [**Shield** 徽章](doc/wiki/zh/Control/Shield.md) | ❎ | ❎ |
➡️| [**ContextMenuStrip** 右键菜单](doc/wiki/zh/Control/ContextMenuStrip.md) | ✅ | ❎ |
➡️| **Image3D** 图片3D | ✅ | ❎ |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 KiB

After

Width:  |  Height:  |  Size: 612 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 KiB

After

Width:  |  Height:  |  Size: 626 KiB

View File

@@ -0,0 +1,35 @@
[Home](../Home.md)・[UpdateLog](../UpdateLog.md)・[Config](../Config.md)・[Theme](../Theme.md)
## Shield
👚
> Concise, consistent, and legible badges.
- DefaultPropertyText
- DefaultEventClick
### Property
Name | Description | Type | Default Value |
:--|:--|:--|:--|
**AutoSize** | Auto Size | bool | false |
**AutoSizeMode** | Auto size mode | [TAutoSize](Enum.md#tautosize) | None |
||||
**Radius** | Rounded corners | int | 6 |
||||
**Text** | Text | string | `AntdUI` |
🌏 **LocalizationText** | International Text | string`?` | `null` |
**Fore** | Text color on the right side | Color`?` | `null` |
**Color** | Background color on the right side | Color`?` | `null` |
||||
**Logo** | Logo | Image`?` | `null` |
**LogoSvg** | Logo SVG | string`?` | `null` |
||||
**Label** | Left text | string`?` | `null` |
🌏 **LocalizationLabel** | International Left text | string`?` | `null` |
**LabelFore** | Text color on the left side | Color`?` | `null` |
**LabelColor** | Background color on the left side | Color`?` | `null` |
**Bold** | Bold text on the left | bool | false |
||||
**ShadowOffsetX** | Shadow OffsetX | int | 0 |
**ShadowOffsetY** | Shadow OffsetY | int | 0 |

View File

@@ -0,0 +1,36 @@
[首页](../Home.md)・[更新日志](../UpdateLog.md)・[配置](../Config.md)・[主题](../Theme.md)
## Shield
Shield 徽章 👚
> 展示徽章图标。
- 默认属性Text
- 默认事件Click
### 属性
名称 | 描述 | 类型 | 默认值 |
:--|:--|:--|:--|
**AutoSize** | 自动大小 | bool | false |
**AutoSizeMode** | 自动大小模式 | [TAutoSize](Enum.md#tautosize) | None |
||||
**Radius** | 圆角 | int | 6 |
||||
**Text** | 文本 | string | `AntdUI` |
🌏 **LocalizationText** | 国际化文本 | string`?` | `null` |
**Fore** | 右侧部分的文本颜色 | Color`?` | `null` |
**Color** | 右侧部分的背景颜色 | Color`?` | `null` |
||||
**Logo** | Logo | Image`?` | `null` |
**LogoSvg** | Logo SVG | string`?` | `null` |
||||
**Label** | 左侧文本 | string`?` | `null` |
🌏 **LocalizationLabel** | 国际化左侧文本 | string`?` | `null` |
**LabelFore** | 左侧部分的文本颜色 | Color`?` | `null` |
**LabelColor** | 左侧部分的背景颜色 | Color`?` | `null` |
**Bold** | 左侧文本粗体 | bool | false |
||||
**ShadowOffsetX** | 阴影偏移X | int | 0 |
**ShadowOffsetY** | 阴影偏移Y | int | 0 |

View File

@@ -16,19 +16,21 @@
// CSDN: https://blog.csdn.net/v_132
// QQ: 17379620
using System.Drawing;
namespace Demo.Controls
{
partial class Shield
{
/// <summary>
/// 必需的设计器变量。
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@@ -38,96 +40,184 @@ namespace Demo.Controls
base.Dispose(disposing);
}
#region
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
header1 = new AntdUI.PageHeader();
shield1 = new AntdUI.Shield();
shield2 = new AntdUI.Shield();
shield3 = new AntdUI.Shield();
shield4 = new AntdUI.Shield();
shield5 = new AntdUI.Shield();
shield6 = new AntdUI.Shield();
shield7 = new AntdUI.Shield();
shield8 = new AntdUI.Shield();
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
flowLayoutPanel1.SuspendLayout();
SuspendLayout();
//
// header1
//
header1.Description = "展示徽章图标。";
header1.Dock = System.Windows.Forms.DockStyle.Top;
header1.Font = new Font("Microsoft YaHei UI", 12F);
header1.LocalizationDescription = "Shield.Description";
header1.LocalizationText = "Shield.Text";
header1.Location = new Point(0, 0);
header1.Name = "header1";
header1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
header1.Size = new Size(740, 74);
header1.TabIndex = 4;
header1.Text = "Shield 徽章";
header1.UseTitleFont = true;
//
// shield1
//
shield1.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
shield1.Location = new System.Drawing.Point(436, 18);
shield1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
shield1.AutoSizeMode = AntdUI.TAutoSize.Auto;
shield1.Color = Color.FromArgb(0, 126, 198);
shield1.Label = "AntdUI";
shield1.Location = new Point(0, 0);
shield1.Margin = new System.Windows.Forms.Padding(0, 0, 10, 0);
shield1.Name = "shield1";
shield1.Padding = new System.Windows.Forms.Padding(5);
shield1.Radius = 0;
shield1.Size = new System.Drawing.Size(160, 55);
shield1.StatusColor = System.Drawing.Color.FromArgb(93, 176, 186);
shield1.StatusText = "Apache 2.0";
shield1.SubjectColor = System.Drawing.Color.FromArgb(84, 84, 84);
shield1.SubjectText = "Licenses";
shield1.Size = new Size(108, 28);
shield1.TabIndex = 0;
shield1.Text = "shield1";
shield1.Text = "v2.0.6";
//
// shield2
//
shield2.Location = new System.Drawing.Point(13, 26);
shield2.AutoSizeMode = AntdUI.TAutoSize.Auto;
shield2.Color = Color.FromArgb(247, 70, 88);
shield2.Label = "QQ群";
shield2.LocalizationLabel = "Shield.qq";
shield2.Location = new Point(118, 0);
shield2.LogoSvg = "QqOutlined";
shield2.Margin = new System.Windows.Forms.Padding(0, 0, 10, 0);
shield2.Name = "shield2";
shield2.Padding = new System.Windows.Forms.Padding(5);
shield2.Size = new System.Drawing.Size(119, 38);
shield2.StatusColor = System.Drawing.Color.FromArgb(17, 130, 195);
shield2.StatusText = "V2.0.6";
shield2.SubjectColor = System.Drawing.Color.FromArgb(84, 84, 84);
shield2.SubjectText = "AntdUI";
shield2.TabIndex = 1;
shield2.Text = "shield2";
shield2.Radius = 0;
shield2.Size = new Size(157, 28);
shield2.TabIndex = 0;
shield2.Text = "328884096";
//
// shield3
//
shield3.Location = new System.Drawing.Point(138, 26);
shield3.AutoSizeMode = AntdUI.TAutoSize.Auto;
shield3.Label = "downloads";
shield3.Location = new Point(582, 0);
shield3.Margin = new System.Windows.Forms.Padding(0, 0, 10, 0);
shield3.Name = "shield3";
shield3.Padding = new System.Windows.Forms.Padding(5);
shield3.Size = new System.Drawing.Size(154, 39);
shield3.StatusColor = System.Drawing.Color.FromArgb(76, 205, 27);
shield3.StatusText = "Apache 2.0";
shield3.SubjectColor = System.Drawing.Color.FromArgb(84, 84, 84);
shield3.SubjectText = "Licenses";
shield3.TabIndex = 2;
shield3.Text = "shield3";
shield3.Radius = 0;
shield3.Size = new Size(119, 28);
shield3.TabIndex = 0;
shield3.Text = "61k";
//
// shield4
//
shield4.Location = new System.Drawing.Point(309, 31);
shield4.AutoSizeMode = AntdUI.TAutoSize.Auto;
shield4.Color = Color.FromArgb(22, 119, 255);
shield4.Label = "AntDesign";
shield4.Location = new Point(436, 0);
shield4.LogoSvg = "AntDesignOutlined";
shield4.Margin = new System.Windows.Forms.Padding(0, 0, 10, 0);
shield4.Name = "shield4";
shield4.Padding = new System.Windows.Forms.Padding(5);
shield4.Radius = 0;
shield4.Size = new System.Drawing.Size(120, 29);
shield4.StatusColor = System.Drawing.Color.FromArgb(17, 130, 195);
shield4.StatusText = "V2.0.6";
shield4.SubjectColor = System.Drawing.Color.FromArgb(84, 84, 84);
shield4.SubjectText = "AntdUI";
shield4.TabIndex = 3;
shield4.Text = "shield4";
shield4.Size = new Size(136, 28);
shield4.TabIndex = 0;
shield4.Text = "5.0";
//
// shield5
//
shield5.AutoSizeMode = AntdUI.TAutoSize.Auto;
shield5.Color = Color.FromArgb(78, 177, 186);
shield5.Label = "license";
shield5.Location = new Point(285, 0);
shield5.Margin = new System.Windows.Forms.Padding(0, 0, 10, 0);
shield5.Name = "shield5";
shield5.Radius = 0;
shield5.Size = new Size(141, 28);
shield5.TabIndex = 0;
shield5.Text = "Apache 2.0";
//
// shield6
//
shield6.AutoSizeMode = AntdUI.TAutoSize.Auto;
shield6.Color = Color.FromArgb(0, 126, 198);
shield6.Font = new Font("Microsoft YaHei UI", 12F);
shield6.Label = "flat style";
shield6.Location = new Point(14, 149);
shield6.Name = "shield6";
shield6.ShadowOffsetY = 2;
shield6.Size = new Size(157, 34);
shield6.TabIndex = 0;
shield6.Text = "you like";
//
// shield7
//
shield7.AutoSizeMode = AntdUI.TAutoSize.Auto;
shield7.Color = Color.BlueViolet;
shield7.Font = new Font("Microsoft YaHei UI", 12F);
shield7.Location = new Point(208, 149);
shield7.Name = "shield7";
shield7.ShadowOffsetY = 2;
shield7.Size = new Size(147, 34);
shield7.TabIndex = 0;
shield7.Text = "just the message";
//
// shield8
//
shield8.AutoSizeMode = AntdUI.TAutoSize.Auto;
shield8.Bold = true;
shield8.Font = new Font("Microsoft YaHei UI", 12F);
shield8.Label = "style";
shield8.Location = new Point(14, 206);
shield8.Name = "shield8";
shield8.Radius = 0;
shield8.Size = new Size(178, 34);
shield8.TabIndex = 0;
shield8.Text = "for-the-badge";
//
// flowLayoutPanel1
//
flowLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
flowLayoutPanel1.Controls.Add(shield1);
flowLayoutPanel1.Controls.Add(shield2);
flowLayoutPanel1.Controls.Add(shield5);
flowLayoutPanel1.Controls.Add(shield4);
flowLayoutPanel1.Controls.Add(shield3);
flowLayoutPanel1.Location = new Point(14, 80);
flowLayoutPanel1.Name = "flowLayoutPanel1";
flowLayoutPanel1.Size = new Size(712, 64);
flowLayoutPanel1.TabIndex = 0;
//
// Shield
//
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
Controls.Add(shield4);
Controls.Add(shield3);
Controls.Add(shield2);
Controls.Add(shield1);
Font = new System.Drawing.Font("Microsoft YaHei UI", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
Controls.Add(flowLayoutPanel1);
Controls.Add(shield7);
Controls.Add(shield8);
Controls.Add(shield6);
Controls.Add(header1);
Font = new Font("Microsoft YaHei UI", 10F);
Name = "Shield";
Size = new System.Drawing.Size(653, 231);
Size = new Size(740, 514);
flowLayoutPanel1.ResumeLayout(false);
flowLayoutPanel1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private AntdUI.PageHeader header1;
private AntdUI.Button button1;
private AntdUI.Shield shield1;
private AntdUI.Shield shield2;
private AntdUI.Shield shield3;
private AntdUI.Shield shield4;
private AntdUI.Shield shield5;
private AntdUI.Shield shield6;
private AntdUI.Shield shield7;
private AntdUI.Shield shield8;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}

View File

@@ -671,6 +671,14 @@ namespace Demo
case "Spin.btnWindow":
return "Entire window";
//Shield ----------------------------
case "Shield.Text":
return "Shield";
case "Shield.Description":
return "Concise, consistent, and legible badges.";
case "Shield.qq":
return "QQ Group";
#endregion
case "Loading":

Binary file not shown.

View File

@@ -391,15 +391,6 @@ namespace Demo {
}
}
/// <summary>
/// 查找类似 &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;120&quot; height=&quot;20&quot;&gt;&lt;mask id=&quot;icons&quot;&gt;&lt;rect width=&quot;120&quot; height=&quot;20&quot; rx=&quot;3&quot; fill=&quot;#fff&quot;&gt;&lt;/rect&gt;&lt;/mask&gt; &lt;g mask=&quot;url(#icons)&quot;&gt;&lt;path fill=&quot;#555555&quot; d=&quot;M0 0h62v20H0z&quot;&gt;&lt;/path&gt;&lt;path fill=&quot;#1e9fff&quot; d=&quot;M62 0h58v20H62z&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;g fill=&quot;#fff&quot; text-anchor=&quot;middle&quot; font-family=&quot;DejaVu Sans,Verdana,Geneva,sans-serif&quot; font-size=&quot;11&quot;&gt;&lt;text x=&quot;31&quot; y=&quot;15&quot; fill=&quot;#010101&quot; fill-opacity=&quot;.3&quot;&gt;version&lt;/text&gt;&lt;text x=&quot;31&quot; y=&quot;14&quot; fill=&quot;#ffffff&quot;&gt;version&lt;/text&gt;&lt;text x=&quot;91&quot; y=&quot;15&quot; fill=&quot;#0 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Shield {
get {
return ResourceManager.GetString("Shield", resourceCulture);
}
}
/// <summary>
/// 查找类似 &lt;svg t=&quot;1744710055284&quot; class=&quot;icon&quot; viewBox=&quot;0 0 1024 1024&quot; version=&quot;1.1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; p-id=&quot;2678&quot; width=&quot;64&quot; height=&quot;64&quot;&gt;&lt;path d=&quot;M102 409.542c-10.237 0-20.474-3.905-28.284-11.716-15.621-15.621-15.621-40.947 0-56.568 59.201-59.201 128.208-105.043 205.103-136.254C353.087 174.86 431.541 159.576 512 159.576c80.46 0 158.913 15.284 233.182 45.428 76.896 31.21 145.902 77.053 205.103 136.254 15.621 15.621 15.621 40.948 0 56.568-15.621 15.622-40.947 15.621-56.568 0C791.667 295.777 656.104 239 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>

View File

@@ -288,7 +288,4 @@
<data name="ContextMenuStrip" xml:space="preserve">
<value>&lt;svg t="1744710281622" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5854" width="64" height="64"&gt;&lt;path d="M870.4 51.2H153.6a102.4 102.4 0 0 0-102.4 102.4v716.8a102.4 102.4 0 0 0 102.4 102.4h716.8a102.4 102.4 0 0 0 102.4-102.4V153.6a102.4 102.4 0 0 0-102.4-102.4z m51.2 768a102.4 102.4 0 0 1-102.4 102.4H204.8a102.4 102.4 0 0 1-102.4-102.4V204.8a102.4 102.4 0 0 1 102.4-102.4h614.4a102.4 102.4 0 0 1 102.4 102.4v614.4zM358.4 307.2h460.8V256H358.4v51.2z m0 204.8h460.8V460.8H358.4v51.2zM204.8 307.2h102.4V256H204.8v51.2z m0 204.8h102.4V460.8H204.8v51.2z m153.6 204.8h460.8v-51.2H358.4v51.2z m-153.6 0h102.4v-51.2H204.8v51.2z" fill="#1296db" p-id="5855"&gt;&lt;/path&gt;&lt;/svg&gt;</value>
</data>
<data name="Shield" xml:space="preserve">
<value>&lt;svg xmlns="http://www.w3.org/2000/svg" width="120" height="20"&gt;&lt;mask id="icons"&gt;&lt;rect width="120" height="20" rx="3" fill="#fff"&gt;&lt;/rect&gt;&lt;/mask&gt; &lt;g mask="url(#icons)"&gt;&lt;path fill="#555555" d="M0 0h62v20H0z"&gt;&lt;/path&gt;&lt;path fill="#1e9fff" d="M62 0h58v20H62z"&gt;&lt;/path&gt;&lt;/g&gt;&lt;g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"&gt;&lt;text x="31" y="15" fill="#010101" fill-opacity=".3"&gt;version&lt;/text&gt;&lt;text x="31" y="14" fill="#ffffff"&gt;version&lt;/text&gt;&lt;text x="91" y="15" fill="#010101" fill-opacity=".3"&gt;V2.0.6&lt;/text&gt;&lt;text x="91" y="14" fill="#ffffff"&gt;V2.0.6&lt;/text&gt;&lt;/g&gt;&lt;/svg&gt;</value>
</data>
</root>

View File

@@ -391,15 +391,6 @@ namespace Demo {
}
}
/// <summary>
/// 查找类似 &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;120&quot; height=&quot;20&quot;&gt;&lt;mask id=&quot;icons&quot;&gt;&lt;rect width=&quot;120&quot; height=&quot;20&quot; rx=&quot;3&quot; fill=&quot;#fff&quot;&gt;&lt;/rect&gt;&lt;/mask&gt; &lt;g mask=&quot;url(#icons)&quot;&gt;&lt;path fill=&quot;#555555&quot; d=&quot;M0 0h62v20H0z&quot;&gt;&lt;/path&gt;&lt;path fill=&quot;#1e9fff&quot; d=&quot;M62 0h58v20H62z&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;g fill=&quot;#fff&quot; text-anchor=&quot;middle&quot; font-family=&quot;DejaVu Sans,Verdana,Geneva,sans-serif&quot; font-size=&quot;11&quot;&gt;&lt;text x=&quot;31&quot; y=&quot;15&quot; fill=&quot;#010101&quot; fill-opacity=&quot;.3&quot;&gt;version&lt;/text&gt;&lt;text x=&quot;31&quot; y=&quot;14&quot; fill=&quot;#ffffff&quot;&gt;version&lt;/text&gt;&lt;text x=&quot;91&quot; y=&quot;15&quot; fill=&quot;#0 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Shield {
get {
return ResourceManager.GetString("Shield", resourceCulture);
}
}
/// <summary>
/// 查找类似 &lt;svg t=&quot;1744710055284&quot; class=&quot;icon&quot; viewBox=&quot;0 0 1024 1024&quot; version=&quot;1.1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; p-id=&quot;2678&quot; width=&quot;64&quot; height=&quot;64&quot;&gt;&lt;path d=&quot;M102 409.542c-10.237 0-20.474-3.905-28.284-11.716-15.621-15.621-15.621-40.947 0-56.568 59.201-59.201 128.208-105.043 205.103-136.254C353.087 174.86 431.541 159.576 512 159.576c80.46 0 158.913 15.284 233.182 45.428 76.896 31.21 145.902 77.053 205.103 136.254 15.621 15.621 15.621 40.948 0 56.568-15.621 15.622-40.947 15.621-56.568 0C791.667 295.777 656.104 239 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>

View File

@@ -288,7 +288,4 @@
<data name="ContextMenuStrip" xml:space="preserve">
<value>&lt;svg t="1744710281622" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5854" width="64" height="64"&gt;&lt;path d="M870.4 51.2H153.6a102.4 102.4 0 0 0-102.4 102.4v716.8a102.4 102.4 0 0 0 102.4 102.4h716.8a102.4 102.4 0 0 0 102.4-102.4V153.6a102.4 102.4 0 0 0-102.4-102.4z m51.2 768a102.4 102.4 0 0 1-102.4 102.4H204.8a102.4 102.4 0 0 1-102.4-102.4V204.8a102.4 102.4 0 0 1 102.4-102.4h614.4a102.4 102.4 0 0 1 102.4 102.4v614.4zM358.4 307.2h460.8V256H358.4v51.2z m0 204.8h460.8V460.8H358.4v51.2zM204.8 307.2h102.4V256H204.8v51.2z m0 204.8h102.4V460.8H204.8v51.2z m153.6 204.8h460.8v-51.2H358.4v51.2z m-153.6 0h102.4v-51.2H204.8v51.2z" fill="#1296db" p-id="5855"&gt;&lt;/path&gt;&lt;/svg&gt;</value>
</data>
<data name="Shield" xml:space="preserve">
<value>&lt;svg xmlns="http://www.w3.org/2000/svg" width="120" height="20"&gt;&lt;mask id="icons"&gt;&lt;rect width="120" height="20" rx="3" fill="#fff"&gt;&lt;/rect&gt;&lt;/mask&gt; &lt;g mask="url(#icons)"&gt;&lt;path fill="#555555" d="M0 0h62v20H0z"&gt;&lt;/path&gt;&lt;path fill="#1e9fff" d="M62 0h58v20H62z"&gt;&lt;/path&gt;&lt;/g&gt;&lt;g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"&gt;&lt;text x="31" y="15" fill="#010101" fill-opacity=".3"&gt;version&lt;/text&gt;&lt;text x="31" y="14" fill="#ffffff"&gt;version&lt;/text&gt;&lt;text x="91" y="15" fill="#010101" fill-opacity=".3"&gt;V2.0.6&lt;/text&gt;&lt;text x="91" y="14" fill="#ffffff"&gt;V2.0.6&lt;/text&gt;&lt;/g&gt;&lt;/svg&gt;</value>
</data>
</root>

View File

@@ -27,58 +27,91 @@ namespace AntdUI
/// <summary>
/// Shield 徽章
/// </summary>
/// <remarks>展示设备信号。</remarks>
/// <remarks>展示徽章图标。</remarks>
[Description("Shield 徽章")]
[ToolboxItem(true)]
public class Shield:IControl
public class Shield : IControl, IEventListener
{
#region
public Shield()
{
base.Padding = new Padding(5);
SubjectColor = Color.FromArgb(84, 84, 84);
StatusColor = Color.FromArgb(17, 130, 195);
SubjectText = "Licenses";
StatusText = "Apache 2.0";
AutoSize = true;
}
#endregion
#region
Color? subjectColor;
Color? fore;
/// <summary>
/// 填充颜色
/// 右侧部分的文本颜色
/// </summary>
[Description("标题颜色"), Category("外观"), DefaultValue(null)]
[Description("右侧部分的文本颜色"), Category("外观"), DefaultValue(null)]
[Editor(typeof(Design.ColorEditor), typeof(UITypeEditor))]
public Color? SubjectColor
public Color? Fore
{
get => subjectColor;
get => fore;
set
{
if (subjectColor == value) return;
subjectColor = value;
if (fore == value) return;
fore = value;
Invalidate();
OnPropertyChanged(nameof(SubjectColor));
OnPropertyChanged(nameof(Fore));
}
}
Color? statusColor;
Color? color;
/// <summary>
/// 填充颜色
/// 右侧部分的背景颜色
/// </summary>
[Description("状态颜色"), Category("外观"), DefaultValue(null)]
[Description("右侧部分的背景颜色"), Category("外观"), DefaultValue(null)]
[Editor(typeof(Design.ColorEditor), typeof(UITypeEditor))]
public Color? StatusColor
public Color? Color
{
get => statusColor;
get => color;
set
{
if (statusColor == value) return;
statusColor = value;
if (color == value) return;
color = value;
Invalidate();
OnPropertyChanged(nameof(StatusColor));
OnPropertyChanged(nameof(Color));
}
}
Color? labelFore;
/// <summary>
/// 左侧部分的文本颜色
/// </summary>
[Description("左侧部分的文本颜色"), Category("外观"), DefaultValue(null)]
[Editor(typeof(Design.ColorEditor), typeof(UITypeEditor))]
public Color? LabelFore
{
get => labelFore;
set
{
if (labelFore == value) return;
labelFore = value;
Invalidate();
OnPropertyChanged(nameof(LabelFore));
}
}
Color? labelColor;
/// <summary>
/// 左侧部分的背景颜色
/// </summary>
[Description("左侧部分的背景颜色"), Category("外观"), DefaultValue(null)]
[Editor(typeof(Design.ColorEditor), typeof(UITypeEditor))]
public Color? LabelColor
{
get => labelColor;
set
{
if (labelColor == value) return;
labelColor = value;
Invalidate();
OnPropertyChanged(nameof(LabelColor));
}
}
@@ -98,92 +131,346 @@ namespace AntdUI
OnPropertyChanged(nameof(Radius));
}
}
#region
string? subject;
string text = "AntdUI";
/// <summary>
/// 文本
/// </summary>
[Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(UITypeEditor))]
[Description("标题"), Category("外观"), DefaultValue(null)]
public string? SubjectText
[Description("文本"), Category("外观"), DefaultValue("AntdUI")]
public override string Text
{
get => subject;
get => this.GetLangIN(LocalizationText, text);
set
{
if (subject == value) return;
subject = value;
Invalidate();
OnPropertyChanged(nameof(SubjectText));
if (text == value) return;
text = value;
if (BeforeAutoSize()) Invalidate();
OnPropertyChanged(nameof(Text));
}
}
string? status;
[Description("文本"), Category("国际化"), DefaultValue(null)]
public string? LocalizationText { get; set; }
string? label;
/// <summary>
/// 文本
/// 左侧文本
/// </summary>
[Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(UITypeEditor))]
[Description("状态"), Category("外观"), DefaultValue(null)]
public string? StatusText
[Description("左侧文本"), Category("外观"), DefaultValue(null), Localizable(true)]
public string? Label
{
get => status;
get => this.GetLangI(LocalizationLabel, label);
set
{
if (status == value) return;
status = value;
Invalidate();
OnPropertyChanged(nameof(StatusText));
if (label == value) return;
label = value;
if (BeforeAutoSize()) Invalidate();
OnPropertyChanged(nameof(Label));
}
}
[Description("左侧文本"), Category("国际化"), DefaultValue(null)]
public string? LocalizationLabel { get; set; }
/// <summary>
/// 左侧文本粗体
/// </summary>
[Description("左侧文本粗体"), Category("外观"), DefaultValue(false)]
public bool Bold { get; set; }
[Description("阴影偏移X"), Category("阴影"), DefaultValue(0)]
public int ShadowOffsetX { get; set; }
[Description("阴影偏移Y"), Category("阴影"), DefaultValue(0)]
public int ShadowOffsetY { get; set; }
#endregion
Image? logo;
[Description("Logo"), Category("外观"), DefaultValue(null)]
public Image? Logo
{
get => logo;
set
{
if (logo == value) return;
logo = value;
if (BeforeAutoSize()) Invalidate();
OnPropertyChanged(nameof(Logo));
}
}
string? logoSvg;
[Description("LogoSvg"), Category("外观"), DefaultValue(null)]
public string? LogoSvg
{
get => logoSvg;
set
{
if (logoSvg == value) return;
logoSvg = value;
if (BeforeAutoSize()) Invalidate();
OnPropertyChanged(nameof(LogoSvg));
}
}
#endregion
#endregion
#region
protected override void OnPaint(PaintEventArgs e)
{
var _rect = ClientRectangle;
var g = e.Graphics.High();
var subjectSize = g.MeasureString(SubjectText, Font);
subjectSize = new Size(subjectSize.Width + Padding.Size.Width, subjectSize.Height + Padding.Size.Height);
var statusSize = g.MeasureString(StatusText, Font);
statusSize = new Size(statusSize.Width + Padding.Size.Width, statusSize.Height + Padding.Size.Height);
var rect = new Rectangle((_rect.Width - (subjectSize.Width + statusSize.Width)) / 2, (_rect.Height - subjectSize.Height) / 2, subjectSize.Width + statusSize.Width, subjectSize.Height);
float _radius = radius * Config.Dpi;
using (var path_pain = rect.RoundPath(_radius))
var _rect = ClientRectangle.DeflateRect(Padding);
if (label == null)
{
using (var brush = new SolidBrush(StatusColor ?? Colour.Text.Get("Shield", ColorScheme)))
var size = g.MeasureString(Text, Font);
int bw = (int)(size.Width * .14F);
int sizeR = size.Width + bw;
if (logoSvg == null && logo == null)
{
g.Fill(brush, path_pain);
int x = _rect.X + (_rect.Width - sizeR) / 2, h = size.Height + (int)(size.Height * .66F), y = _rect.Y + (_rect.Height - h) / 2;
Rectangle rect_r = new Rectangle(x, y, sizeR, h);
PaintBack(g, rect_r);
PaintFore(g, Text, Font, fore ?? System.Drawing.Color.White, rect_r, Bold);
}
using (var bmp = new Bitmap(_rect.Width, _rect.Height))
else
{
using (var g2 = Graphics.FromImage(bmp).High())
{
Color _color = SubjectColor?? Colour.Text.Get("Shield", ColorScheme);
g2.Fill(_color, path_pain);
g2.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
g2.Fill(Brushes.Transparent, new RectangleF(rect.X + subjectSize.Width, 0, rect.Width, bmp.Height));
}
g.Image(bmp, _rect);
int logosize = (int)(size.Height * 1.12F), logosp = (int)(logosize * .274F);
int xc = _rect.X + (_rect.Width - (sizeR + logosize + logosp)) / 2, h = size.Height + (int)(size.Height * .66F), y = _rect.Y + (_rect.Height - h) / 2;
Rectangle rect_l_full = new Rectangle(xc, y, sizeR + logosize + logosp, h),
rect_logo = new Rectangle(xc + bw / 2, _rect.Y + (_rect.Height - logosize) / 2, logosize, logosize),
rect_r = new Rectangle(xc + logosize + logosp, y, sizeR, h);
PaintBack(g, rect_l_full);
Color _fore = fore ?? System.Drawing.Color.White;
if (logo != null) g.Image(logo, rect_logo);
if (logoSvg != null) g.GetImgExtend(logoSvg, rect_logo, _fore);
PaintFore(g, Text, Font, _fore, rect_r, Bold);
}
var subjectRect = new Rectangle(rect.X + Padding.Left, rect.Y + Padding.Top, subjectSize.Width - Padding.Size.Width, subjectSize.Height - Padding.Size.Height);
using (var brush = new SolidBrush(Color.White))
}
else
{
var size = g.MeasureString(Config.NullText, Font);
int bw = (int)(size.Width * .4F);
int sizeR = g.MeasureString(Text, Font).Width + bw, sizeL = g.MeasureString(Label, Font).Width + bw;
if (logoSvg == null && logo == null)
{
g.String(SubjectText, Font, brush, subjectRect);
int xc = _rect.X + (_rect.Width - (sizeR + sizeL)) / 2, h = size.Height + (int)(size.Height * .66F), y = _rect.Y + (_rect.Height - h) / 2;
Rectangle rect_l = new Rectangle(xc, y, sizeL, h), rect_r = new Rectangle(xc + sizeL, y, sizeR, h);
PaintBack(g, rect_l, rect_r);
PaintFore(g, Label, Font, labelFore ?? System.Drawing.Color.White, rect_l);
PaintFore(g, Text, Font, fore ?? System.Drawing.Color.White, rect_r, Bold);
}
var statusRect = new Rectangle(rect.X + subjectSize.Width + Padding.Left, rect.Y + Padding.Top, statusSize.Width - Padding.Size.Width, statusSize.Height - Padding.Size.Height);
using (var brush = new SolidBrush(Color.White))
else
{
g.String(StatusText, Font, brush, statusRect);
int logosize = (int)(size.Height * 1.12F), logosp = (int)(logosize * .274F);
int xc = _rect.X + (_rect.Width - (sizeL + sizeR + logosize + logosp)) / 2, h = size.Height + (int)(size.Height * .66F), y = _rect.Y + (_rect.Height - h) / 2;
Rectangle rect_l_full = new Rectangle(xc, y, sizeL + logosize + logosp, h),
rect_logo = new Rectangle(xc + bw / 2, _rect.Y + (_rect.Height - logosize) / 2, logosize, logosize),
rect_l = new Rectangle(xc + logosize + logosp, y, sizeL, h),
rect_r = new Rectangle(xc + logosize + logosp + sizeL, y, sizeR, h);
PaintBack(g, rect_l_full, rect_r);
Color _label = labelFore ?? System.Drawing.Color.White;
if (logo != null) g.Image(logo, rect_logo);
if (logoSvg != null) g.GetImgExtend(logoSvg, rect_logo, _label);
PaintFore(g, Label, Font, _label, rect_l);
PaintFore(g, Text, Font, fore ?? System.Drawing.Color.White, rect_r, Bold);
}
}
this.PaintBadge(g);
base.OnPaint(e);
}
void PaintBack(Canvas g, Rectangle rect_l, Rectangle rect_r)
{
if (radius > 0)
{
float _radius = radius * Config.Dpi;
using (var path = rect_l.RoundPath(_radius, true, false, false, true))
{
g.Fill(labelColor ?? System.Drawing.Color.FromArgb(85, 85, 85), path);
}
using (var path = rect_r.RoundPath(_radius, false, true, true, false))
{
g.Fill(color ?? System.Drawing.Color.FromArgb(68, 204, 17), path);
}
}
else
{
g.Fill(labelColor ?? System.Drawing.Color.FromArgb(85, 85, 85), rect_l);
g.Fill(color ?? System.Drawing.Color.FromArgb(68, 204, 17), rect_r);
}
}
void PaintBack(Canvas g, Rectangle rect)
{
if (radius > 0)
{
float _radius = radius * Config.Dpi;
using (var path = rect.RoundPath(_radius))
{
g.Fill(color ?? System.Drawing.Color.FromArgb(68, 204, 17), path);
}
}
else g.Fill(color ?? System.Drawing.Color.FromArgb(68, 204, 17), rect);
}
void PaintFore(Canvas g, string? text, Font font, Color color, Rectangle rect, bool bold)
{
if (bold)
{
using (var fontb = new Font(font, FontStyle.Bold))
{
PaintFore(g, text, fontb, color, rect);
}
}
else PaintFore(g, text, font, color, rect);
}
void PaintFore(Canvas g, string? text, Font font, Color color, Rectangle rect)
{
if (ShadowOffsetX > 0 || ShadowOffsetY > 0) g.String(text, font, System.Drawing.Color.FromArgb(77, 1, 1, 1), new Rectangle(rect.X + (int)(ShadowOffsetX * Config.Dpi), rect.Y + (int)(ShadowOffsetY * Config.Dpi), rect.Width, rect.Height));
g.String(text, font, color, rect);
}
#endregion
#region
/// <summary>
/// 自动大小
/// </summary>
[Browsable(true)]
[Description("自动大小"), Category("外观"), DefaultValue(false)]
public override bool AutoSize
{
get => base.AutoSize;
set
{
if (base.AutoSize == value) return;
base.AutoSize = value;
if (value)
{
if (autoSize == TAutoSize.None) autoSize = TAutoSize.Auto;
}
else autoSize = TAutoSize.None;
BeforeAutoSize();
}
}
TAutoSize autoSize = TAutoSize.None;
/// <summary>
/// 自动大小模式
/// </summary>
[Description("自动大小模式"), Category("外观"), DefaultValue(TAutoSize.None)]
public TAutoSize AutoSizeMode
{
get => autoSize;
set
{
if (autoSize == value) return;
autoSize = value;
base.AutoSize = autoSize != TAutoSize.None;
BeforeAutoSize();
}
}
protected override void OnFontChanged(EventArgs e)
{
BeforeAutoSize();
base.OnFontChanged(e);
}
public override Size GetPreferredSize(Size proposedSize)
{
if (autoSize == TAutoSize.None) return base.GetPreferredSize(proposedSize);
else if (autoSize == TAutoSize.Width) return new Size(PSize.Width, base.GetPreferredSize(proposedSize).Height);
else if (autoSize == TAutoSize.Height) return new Size(base.GetPreferredSize(proposedSize).Width, PSize.Height);
return PSize;
}
public Size PSize
{
get
{
return Helper.GDI(g =>
{
if (label == null)
{
var size = g.MeasureString(Text, Font);
int textSize = size.Width + (int)(size.Width * .14F);
if (logoSvg == null && logo == null) return new Size(textSize + Padding.Horizontal, (int)(size.Height + (size.Height * .66F) + Padding.Vertical));
else
{
int logosize = (int)(size.Height * 1.12F), logosp = (int)(logosize * .274F);
return new Size(textSize + logosize + logosp + Padding.Horizontal, (int)(size.Height + (size.Height * .66F) + Padding.Vertical));
}
}
else
{
var size = g.MeasureString(Config.NullText, Font);
int bw = (int)(size.Width * .4F);
int textSize = g.MeasureString(Text, Font).Width + bw, subSize = g.MeasureString(Label, Font).Width + bw;
if (logoSvg == null && logo == null) return new Size(textSize + subSize + Padding.Horizontal, (int)(size.Height + (size.Height * .66F) + Padding.Vertical));
else
{
int logosize = (int)(size.Height * 1.12F), logosp = (int)(logosize * .274F);
return new Size(textSize + subSize + logosize + logosp + Padding.Horizontal, (int)(size.Height + (size.Height * .66F) + Padding.Vertical));
}
}
});
}
}
protected override void OnResize(EventArgs e)
{
BeforeAutoSize();
base.OnResize(e);
}
bool BeforeAutoSize()
{
if (autoSize == TAutoSize.None) return true;
if (InvokeRequired) return ITask.Invoke(this, BeforeAutoSize);
var PS = PSize;
switch (autoSize)
{
case TAutoSize.Width:
if (Width == PS.Width) return true;
Width = PS.Width;
break;
case TAutoSize.Height:
if (Height == PS.Height) return true;
Height = PS.Height;
break;
case TAutoSize.Auto:
default:
if (Width == PS.Width && Height == PS.Height) return true;
Size = PS;
break;
}
return false;
}
#endregion
#region
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
this.AddListener();
}
public void HandleEvent(EventType id, object? tag)
{
switch (id)
{
case EventType.LANG:
BeforeAutoSize();
break;
}
}
#endregion
}
#endregion
}
}

View File

@@ -1008,7 +1008,7 @@ namespace AntdUI
/// <summary>
/// 文本
/// </summary>
[Category("外观"), Description("文本")]
[Category("外观"), Description("文本"), Localizable(true)]
public string Text
{
get => Localization.GetLangI(LocalizationText, _text, new string?[] { "{id}", ID }) ?? _text;

View File

@@ -80,6 +80,11 @@ namespace AntdUI
static Svg.SvgDocument? SvgDocument(string svg)
{
if (svg.StartsWith("<svg")) return Svg.SvgDocument.FromSvg<Svg.SvgDocument>(svg);
else if (svg.Contains("svg+xml;base64,"))
{
var xml = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(svg.Substring(svg.IndexOf("base64,") + 7)));
return Svg.SvgDocument.FromSvg<Svg.SvgDocument>(xml);
}
else if (SvgDb.Custom.TryGetValue(svg, out var rsvg)) return Svg.SvgDocument.FromSvg<Svg.SvgDocument>(rsvg);
return null;
}