👾 修复 Table 内容超出、修复 Input 空格被过滤、Menu 新增 InlineNoText、Button 新增 DisplayStyle、LabelTime 新增 DragMove

This commit is contained in:
Tom
2025-07-01 13:49:09 +08:00
parent 00aab4bb4f
commit 6c702f3e31
24 changed files with 409 additions and 1024 deletions

View File

@@ -16,7 +16,6 @@
// CSDN: https://blog.csdn.net/v_132
// QQ: 17379620
using System;
using System.Windows.Forms;
namespace Demo.Controls
@@ -36,24 +35,25 @@ namespace Demo.Controls
private void edit1_TextChanged(object sender, AntdUI.CollapseEditChangedEventArgs e)
{
if (string.IsNullOrEmpty(e.Value==null?string.Empty:e.Value.ToString())) return;
if (string.IsNullOrEmpty(e.Value == null ? string.Empty : e.Value.ToString())) return;
AntdUI.Notification.info(form, e.Parent.Text, e.Value.ToString(), AntdUI.TAlignFrom.Top, Font);
}
private void CollapseGroupButton11_CustomInputEdit(object sender, AntdUI.CollapseCustomInputEditEventArgs e)
{
AntdUI.Select select = new AntdUI.Select() {
AntdUI.Select select = new AntdUI.Select()
{
TabIndex = 0,
PrefixSvg= "DiffOutlined",
PlaceholderText="<22><><EFBFBD><EFBFBD>",
PrefixSvg = "DiffOutlined",
PlaceholderText = "<22><><EFBFBD><EFBFBD>",
};
select.Items.AddRange(new object[] { 100,200,300,400,500});
select.Items.AddRange(new object[] { 100, 200, 300, 400, 500 });
e.Edit = select;
}
private void switchButton_CheckedChanged(object sender, AntdUI.CollapseSwitchCheckedChangedEventArgs e)
{
AntdUI.Notification.info(form, e.Parent.Text,e.Checked? e.Value.CheckedText:e.Value.UnCheckedText, AntdUI.TAlignFrom.Top, Font);
AntdUI.Notification.info(form, e.Parent.Text, e.Checked ? e.Value.CheckedText : e.Value.UnCheckedText, AntdUI.TAlignFrom.Top, Font);
}
}

View File

@@ -67,9 +67,18 @@ namespace Demo.Controls
private void switch4_CheckedChanged(object sender, AntdUI.BoolEventArgs e) => menu3.Collapsed = e.Value;
private void switch5_CheckedChanged(object sender, AntdUI.BoolEventArgs e)
{
menu2.Flatten = e.Value;
menu2.Width = e.Value ? 58 : 251;
}
if (e.Value)
{
menu2.Tag = menu2.Mode;
menu2.Mode = AntdUI.TMenuMode.InlineNoText;
menu2.Width = (int)(58 * AntdUI.Config.Dpi);
}
else if (menu2.Tag is AntdUI.TMenuMode mode)
{
menu2.Mode = mode;
menu2.Width = (int)(251 * AntdUI.Config.Dpi);
}
}
}
}

View File

@@ -30,130 +30,104 @@ namespace Demo.Controls
/// </summary>
private void InitializeComponent()
{
this.panel1 = new AntdUI.Panel();
this.transfer1 = new AntdUI.Transfer();
this.panel2 = new AntdUI.Panel();
this.btn_reload = new AntdUI.Button();
this.label_target = new AntdUI.Label();
this.label_source = new AntdUI.Label();
//this.label2 = new AntdUI.Label();
//this.switch_search = new AntdUI.Switch();
this.label1 = new AntdUI.Label();
this.switch_oneWay = new AntdUI.Switch();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
panel1 = new AntdUI.Panel();
transfer1 = new AntdUI.Transfer();
panel2 = new AntdUI.Panel();
btn_reload = new AntdUI.Button();
label_target = new AntdUI.Label();
label_source = new AntdUI.Label();
label1 = new AntdUI.Label();
switch_oneWay = new AntdUI.Switch();
panel1.SuspendLayout();
panel2.SuspendLayout();
SuspendLayout();
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.transfer1);
this.panel1.Location = new System.Drawing.Point(20, 100);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(760, 380);
this.panel1.TabIndex = 0;
panel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
panel1.Controls.Add(transfer1);
panel1.Location = new Point(20, 100);
panel1.Name = "panel1";
panel1.Size = new Size(760, 380);
panel1.TabIndex = 0;
//
// transfer1
//
this.transfer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.transfer1.Location = new System.Drawing.Point(20, 50);
this.transfer1.Name = "transfer1";
this.transfer1.Size = new System.Drawing.Size(720, 310);
this.transfer1.SourceTitle = "源列表";
this.transfer1.TabIndex = 0;
this.transfer1.TargetTitle = "目标列表";
transfer1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
transfer1.Location = new Point(20, 50);
transfer1.MinimumSize = new Size(300, 200);
transfer1.Name = "transfer1";
transfer1.Size = new Size(720, 310);
transfer1.TabIndex = 0;
//
// panel2
//
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel2.Controls.Add(this.btn_reload);
this.panel2.Controls.Add(this.label_target);
this.panel2.Controls.Add(this.label_source);
//this.panel2.Controls.Add(this.label2);
//this.panel2.Controls.Add(this.switch_search);
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.switch_oneWay);
this.panel2.Location = new System.Drawing.Point(20, 20);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(760, 70);
this.panel2.TabIndex = 1;
panel2.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
panel2.Controls.Add(btn_reload);
panel2.Controls.Add(label_target);
panel2.Controls.Add(label_source);
panel2.Controls.Add(label1);
panel2.Controls.Add(switch_oneWay);
panel2.Location = new Point(20, 20);
panel2.Name = "panel2";
panel2.Size = new Size(760, 70);
panel2.TabIndex = 1;
//
// btn_reload
//
this.btn_reload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_reload.Location = new System.Drawing.Point(650, 30);
this.btn_reload.Name = "btn_reload";
this.btn_reload.Size = new System.Drawing.Size(90, 30);
this.btn_reload.TabIndex = 6;
this.btn_reload.Text = "重新加载";
this.btn_reload.Click += new System.EventHandler(this.btn_reload_Click);
btn_reload.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
btn_reload.BorderWidth = 1F;
btn_reload.Location = new Point(650, 30);
btn_reload.Name = "btn_reload";
btn_reload.Size = new Size(90, 30);
btn_reload.TabIndex = 6;
btn_reload.Text = "重新加载";
btn_reload.Click += btn_reload_Click;
//
// label_target
//
this.label_target.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label_target.Location = new System.Drawing.Point(520, 30);
this.label_target.Name = "label_target";
this.label_target.Size = new System.Drawing.Size(120, 30);
this.label_target.TabIndex = 5;
this.label_target.Text = "目标列表: 0项";
this.label_target.TextAlign = ContentAlignment.TopRight;
label_target.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
label_target.Location = new Point(520, 30);
label_target.Name = "label_target";
label_target.Size = new Size(120, 30);
label_target.TabIndex = 5;
label_target.Text = "目标列表: 0项";
label_target.TextAlign = ContentAlignment.TopRight;
//
// label_source
//
this.label_source.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label_source.Location = new System.Drawing.Point(400, 30);
this.label_source.Name = "label_source";
this.label_source.Size = new System.Drawing.Size(120, 30);
this.label_source.TabIndex = 4;
this.label_source.Text = "源列表: 10项";
this.label_source.TextAlign = ContentAlignment.TopRight;
//
// label2
//
//this.label2.Location = new System.Drawing.Point(180, 30);
//this.label2.Name = "label2";
//this.label2.Size = new System.Drawing.Size(80, 30);
//this.label2.TabIndex = 3;
//this.label2.Text = "显示搜索框:";
//
// switch_search
//
//this.switch_search.Location = new System.Drawing.Point(260, 30);
//this.switch_search.Name = "switch_search";
//this.switch_search.Size = new System.Drawing.Size(50, 30);
//this.switch_search.TabIndex = 2;
label_source.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
label_source.Location = new Point(400, 30);
label_source.Name = "label_source";
label_source.Size = new Size(120, 30);
label_source.TabIndex = 4;
label_source.Text = "源列表: 10项";
label_source.TextAlign = ContentAlignment.TopRight;
//
// label1
//
this.label1.Location = new System.Drawing.Point(20, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 30);
this.label1.TabIndex = 1;
this.label1.Text = "单向模式:";
label1.Location = new Point(20, 30);
label1.Name = "label1";
label1.Size = new Size(80, 30);
label1.TabIndex = 1;
label1.Text = "单向模式:";
//
// switch_oneWay
//
this.switch_oneWay.Location = new System.Drawing.Point(100, 30);
this.switch_oneWay.Name = "switch_oneWay";
this.switch_oneWay.Size = new System.Drawing.Size(50, 30);
this.switch_oneWay.TabIndex = 0;
switch_oneWay.Location = new Point(100, 30);
switch_oneWay.Name = "switch_oneWay";
switch_oneWay.Size = new Size(50, 30);
switch_oneWay.TabIndex = 0;
//
// Transfer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "Transfer";
this.Size = new System.Drawing.Size(800, 500);
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
Controls.Add(panel2);
Controls.Add(panel1);
Name = "Transfer";
Size = new Size(800, 500);
panel1.ResumeLayout(false);
panel2.ResumeLayout(false);
ResumeLayout(false);
}

View File

@@ -1,3 +1,21 @@
// COPYRIGHT (C) Tom. ALL RIGHTS RESERVED.
// THE AntdUI PROJECT IS AN WINFORM LIBRARY LICENSED UNDER THE Apache-2.0 License.
// LICENSED UNDER THE Apache License, VERSION 2.0 (THE "License")
// YOU MAY NOT USE THIS FILE EXCEPT IN COMPLIANCE WITH THE License.
// YOU MAY OBTAIN A COPY OF THE LICENSE AT
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE
// DISTRIBUTED UNDER THE LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING PERMISSIONS AND
// LIMITATIONS UNDER THE License.
// GITEE: https://gitee.com/AntdUI/AntdUI
// GITHUB: https://github.com/AntdUI/AntdUI
// CSDN: https://blog.csdn.net/v_132
// QQ: 17379620
using System;
using System.Collections.Generic;
using System.Windows.Forms;
@@ -77,15 +95,15 @@ namespace Demo.Controls
var items = new List<AntdUI.TransferItem>();
Random random = new Random();
int count = random.Next(5, 15);
for (int i = 1; i <= count; i++)
{
items.Add(new AntdUI.TransferItem($"新选项{i}", i));
}
transfer1.Items = items;
transfer1.Reload();
// 更新源列表和目标列表的数量显示
label_source.Text = $"源列表: {transfer1.GetSourceItems().Count}项";
label_target.Text = $"目标列表: {transfer1.GetTargetItems().Count}项";

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
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
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>
@@ -26,36 +26,36 @@
<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
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
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
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
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
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
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
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@@ -88,14 +88,7 @@ namespace Demo {
}
/// <summary>
/// 查找类似 &lt;svg viewBox=&quot;0 0 75 74&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xmlns=&quot;http://www.w3.org/2000/svg&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(-945.000000, -4572.000000)&quot;&gt;
/// &lt;g id=&quot;编组-3&quot; transform=&quot;translate(945.000000, 4572.000000)&quot;&gt;
/// &lt;!-- 60% Green --&gt;
/// &lt;g id=&quot;Bar-Green&quot; transform=&quot;translate(0, 10)&quot;&gt;
/// &lt;rect id=&quot;Bg&quot; fill=&quot;#e0e0e0&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;50&quot; height=&quot;8&quot; rx=&quot;4&quot;&gt;&lt;/rect&gt;
/// [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 &lt;svg xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; viewBox=&quot;0 0 824 140&quot;&gt;&lt;path fill=&quot;#00D379&quot; transform=&quot;scale(2.28898 2.28898)&quot; d=&quot;M339.392 41.4598C339.527 41.7533 339.61 42.0683 339.532 42.3898C339.275 43.4509 338.056 44.7143 337.139 45.2586C336.176 45.83 335.276 45.9465 334.176 46.0066C330.607 46.2015 326.955 46.0427 323.378 46.0364L304.238 46.043C299.846 46.0458 283.113 46.5331 280.137 45.7741C278.922 45.4643 277.949 44.8901 277.299 43.7926C276.666 42.7243 276.367 41.4617 276.213 40.2402C275.766 36.6959 27 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Battery {
get {
@@ -166,15 +159,6 @@ namespace Demo {
}
}
/// <summary>
/// 查找类似 &lt;svg t=&quot;1744710281622&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;5854&quot; width=&quot;64&quot; height=&quot;64&quot;&gt;&lt;path d=&quot;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. [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string ContextMenuStrip {
get {
return ResourceManager.GetString("ContextMenuStrip", resourceCulture);
}
}
/// <summary>
/// 查找类似 &lt;svg viewBox=&quot;0 0 119 67&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(-1287.000000, -1725.000000)&quot;&gt;&lt;g id=&quot;DatePicker&quot; transform=&quot;translate(1287.000000, 1725.000000)&quot;&gt;&lt;g id=&quot;3.DataEntry/Selecte/Default/Unselected&quot;&gt;&lt;g id=&quot;9.Box/1.Cards/4.Border&quot; stroke=&quot;#FFFFFF&quot; stroke-opacity=&quot;0.2&quot;&gt;&lt;g id=&quot;Z/Shape/RectangleRC/2px/RC-A&quot;&gt;&lt;rect id=&quot;outline&quot; x=&quot;0.5&quot; y=&quot;0.5&quot; width=&quot;118&quot; height=&quot;30&quot; rx=&quot;6&quot;&gt;&lt;/rect [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
@@ -392,7 +376,7 @@ namespace Demo {
}
/// <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;; 的本地化字符串。
/// 查找类似 &lt;svg xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; viewBox=&quot;0 0 929 545&quot;&gt;&lt;path fill=&quot;#53C71B&quot; transform=&quot;scale(4.26092 4.26092)&quot; d=&quot;M164.953 13.3737C168.355 13.113 171.945 13.4596 175.243 14.3272C178.834 15.2718 187.295 19.0877 189.186 22.3315C189.181 22.4175 189.17 22.4997 189.149 22.5836C188.887 23.6306 185.526 27.2296 184.587 27.8441C184.528 27.613 184.448 27.3818 184.292 27.1966C180.744 22.9809 173.794 20.7053 168.481 20.3731C163.384 19.6188 156.976 21.8564 152.87 24.8118C151.652 25.6883 150.417 27.2132 14 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Signal {
get {
@@ -410,7 +394,7 @@ namespace Demo {
}
/// <summary>
/// 查找类似 &lt;svg t=&quot;1744710126425&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;3903&quot; width=&quot;64&quot; height=&quot;64&quot;&gt;&lt;path d=&quot;M512 977.92c-257.024 0-465.92-208.896-465.92-465.92S254.976 46.08 512 46.08v119.296c-191.488 0-347.136 155.648-347.136 347.136s155.648 347.136 347.136 347.136 347.136-155.648 347.136-347.136H977.92c0 256.512-208.896 465.408-465.92 465.408z&quot; fill=&quot;#1296db&quot; p-id=&quot;3904&quot;&gt;&lt;/path&gt;&lt;path d=&quot;M512 150.528C312.32 150.528 150.528 312.32 150.528 512S312.32 873.472 512 8 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 &lt;svg viewBox=&quot;-8 -8 40 40&quot;&gt;&lt;path fill=&quot;#ffffff&quot; d=&quot;M12 4.5a7.5 7.5 0 1 0 0 15a7.5 7.5 0 0 0 0-15M1.5 12C1.5 6.201 6.201 1.5 12 1.5S22.5 6.201 22.5 12S17.799 22.5 12 22.5S1.5 17.799 1.5 12&quot; fill-opacity=&quot;.1&quot;/&gt;&lt;path fill=&quot;#1668dc&quot; d=&quot;M12 4.5a7.46 7.46 0 0 0-5.187 2.083a1.5 1.5 0 0 1-2.075-2.166A10.46 10.46 0 0 1 12 1.5a1.5 1.5 0 0 1 0 3&quot;/&gt;&lt;/svg&gt; 的本地化字符串。
/// </summary>
internal static string Spin {
get {
@@ -419,7 +403,7 @@ namespace Demo {
}
/// <summary>
/// 查找类似 &lt;svg viewBox=&quot;0 0 160 112&quot; fill=&quot;none&quot;&gt;&lt;rect width=&quot;160&quot; height=&quot;112&quot; rx=&quot;4&quot; fill=&quot;#1668DC&quot; fill-opacity=&quot;0.2&quot;/&gt;&lt;path opacity=&quot;0.5&quot; d=&quot;M10 12C10 10.8954 10.8954 10 12 10H56V102H12C10.8954 102 10 101.105 10 100V12Z&quot; fill=&quot;#1668DC&quot; fill-opacity=&quot;0.8&quot;/&gt;&lt;rect opacity=&quot;0.5&quot; x=&quot;57&quot; y=&quot;10&quot; width=&quot;46&quot; height=&quot;92&quot; fill=&quot;#1668DC&quot; fill-opacity=&quot;0.8&quot;/&gt;&lt;path opacity=&quot;0.5&quot; d=&quot;M104 10H148C149.105 10 150 10.8954 150 12V100C150 101.105 149.105 102 148 102H104V10Z&quot; fill=&quot;#1668DC&quot; fill-opacity=&quot;0.8&quot;/&gt;&lt;path d=&quot;M55.625 49H57.37 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 &lt;svg viewBox=&quot;0 0 160 112&quot;&gt;&lt;rect width=&quot;160&quot; height=&quot;112&quot; rx=&quot;4&quot; fill=&quot;#1668DC&quot; fill-opacity=&quot;0.2&quot;/&gt;&lt;path opacity=&quot;0.5&quot; d=&quot;M10 12C10 10.8954 10.8954 10 12 10H56V102H12C10.8954 102 10 101.105 10 100V12Z&quot; fill=&quot;#1668DC&quot; fill-opacity=&quot;0.8&quot;/&gt;&lt;rect opacity=&quot;0.5&quot; x=&quot;57&quot; y=&quot;10&quot; width=&quot;46&quot; height=&quot;92&quot; fill=&quot;#1668DC&quot; fill-opacity=&quot;0.8&quot;/&gt;&lt;path opacity=&quot;0.5&quot; d=&quot;M104 10H148C149.105 10 150 10.8954 150 12V100C150 101.105 149.105 102 148 102H104V10Z&quot; fill=&quot;#1668DC&quot; fill-opacity=&quot;0.8&quot;/&gt;&lt;path d=&quot;M55.625 49H57.375V63H55.625V [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Splitter {
get {
@@ -509,13 +493,7 @@ namespace Demo {
}
/// <summary>
/// 查找类似 &lt;svg width=&quot;196px&quot; height=&quot;116px&quot; viewBox=&quot;0 0 196 116&quot; version=&quot;1.1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;
/// &lt;title&gt;编组 7&lt;/title&gt;
/// &lt;defs&gt;
/// &lt;path d=&quot;M5.84,3.5 L2.16,3.5 C2.0715,3.5 2,3.517875 2,3.54 L2,4.46 C2,4.482125 2.0715,4.5 2.16,4.5 L5.84,4.5 C5.9285,4.5 6,4.482125 6,4.46 L6,3.54 C6,3.517875 5.9285,3.5 5.84,3.5 Z&quot; id=&quot;path-1&quot;&gt;&lt;/path&gt;
/// &lt;/defs&gt;
/// &lt;g id=&quot;组件骨架图更新_202311&quot; stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;
/// &lt;g id=&quot; [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 &lt;svg viewBox=&quot;0 0 196 116&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;&lt;defs&gt;&lt;path d=&quot;M5.84,3.5 L2.16,3.5 C2.0715,3.5 2,3.517875 2,3.54 L2,4.46 C2,4.482125 2.0715,4.5 2.16,4.5 L5.84,4.5 C5.9285,4.5 6,4.482125 6,4.46 L6,3.54 C6,3.517875 5.9285,3.5 5.84,3.5 Z&quot; id=&quot;path-1&quot;&gt;&lt;/path&gt;&lt;/defs&gt;&lt;g id=&quot;组件骨架图更新_202311&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(-885.000000, -2421.000000)&quot;&gt;&lt;g id=&quot;编组-7&quot; transform=&quot;translate(885.000000, 2421.000000)&quot;&gt;&lt;rect id=&quot;R [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Transfer {
get {

File diff suppressed because one or more lines are too long

View File

@@ -88,14 +88,7 @@ namespace Demo {
}
/// <summary>
/// 查找类似 &lt;svg viewBox=&quot;0 0 75 74&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; xmlns=&quot;http://www.w3.org/2000/svg&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(-945.000000, -4572.000000)&quot;&gt;
/// &lt;g id=&quot;编组-3&quot; transform=&quot;translate(945.000000, 4572.000000)&quot;&gt;
/// &lt;!-- 60% Green --&gt;
/// &lt;g id=&quot;Bar-Green&quot; transform=&quot;translate(0, 10)&quot;&gt;
/// &lt;rect id=&quot;Bg&quot; fill=&quot;#e0e0e0&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;50&quot; height=&quot;8&quot; rx=&quot;4&quot;&gt;&lt;/rect&gt;
/// [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 &lt;svg xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; viewBox=&quot;0 0 824 140&quot;&gt;&lt;path fill=&quot;#00D379&quot; transform=&quot;scale(2.28898 2.28898)&quot; d=&quot;M339.392 41.4598C339.527 41.7533 339.61 42.0683 339.532 42.3898C339.275 43.4509 338.056 44.7143 337.139 45.2586C336.176 45.83 335.276 45.9465 334.176 46.0066C330.607 46.2015 326.955 46.0427 323.378 46.0364L304.238 46.043C299.846 46.0458 283.113 46.5331 280.137 45.7741C278.922 45.4643 277.949 44.8901 277.299 43.7926C276.666 42.7243 276.367 41.4617 276.213 40.2402C275.766 36.6959 27 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Battery {
get {
@@ -166,15 +159,6 @@ namespace Demo {
}
}
/// <summary>
/// 查找类似 &lt;svg t=&quot;1744710281622&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;5854&quot; width=&quot;64&quot; height=&quot;64&quot;&gt;&lt;path d=&quot;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. [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string ContextMenuStrip {
get {
return ResourceManager.GetString("ContextMenuStrip", resourceCulture);
}
}
/// <summary>
/// 查找类似 &lt;svg viewBox=&quot;0 0 121 69&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(-1286.000000, -1724.000000)&quot;&gt;&lt;g id=&quot;DatePicker&quot; transform=&quot;translate(1287.000000, 1725.000000)&quot;&gt;&lt;g id=&quot;3.DataEntry/Selecte/Default/Unselected&quot;&gt;&lt;g id=&quot;3.DataEntry/Input/Default/Basic-#&quot;&gt;&lt;g id=&quot;Z/Shape/RectangleRC/2px/RC-A&quot;&gt;&lt;rect id=&quot;BG/fill&quot; fill=&quot;#FFFFFF&quot; fill-rule=&quot;nonzero&quot; x=&quot;0.5&quot; y=&quot;0.5&quot; width=&quot;118&quot; height=&quot;30&quot; rx=&quot;1&quot;&gt;&lt;/ [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
@@ -392,7 +376,7 @@ namespace Demo {
}
/// <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;; 的本地化字符串。
/// 查找类似 &lt;svg xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; viewBox=&quot;0 0 929 545&quot;&gt;&lt;path fill=&quot;#53C71B&quot; transform=&quot;scale(4.26092 4.26092)&quot; d=&quot;M164.953 13.3737C168.355 13.113 171.945 13.4596 175.243 14.3272C178.834 15.2718 187.295 19.0877 189.186 22.3315C189.181 22.4175 189.17 22.4997 189.149 22.5836C188.887 23.6306 185.526 27.2296 184.587 27.8441C184.528 27.613 184.448 27.3818 184.292 27.1966C180.744 22.9809 173.794 20.7053 168.481 20.3731C163.384 19.6188 156.976 21.8564 152.87 24.8118C151.652 25.6883 150.417 27.2132 14 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Singal {
get {
@@ -410,7 +394,7 @@ namespace Demo {
}
/// <summary>
/// 查找类似 &lt;svg t=&quot;1744710126425&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;3903&quot; width=&quot;64&quot; height=&quot;64&quot;&gt;&lt;path d=&quot;M512 977.92c-257.024 0-465.92-208.896-465.92-465.92S254.976 46.08 512 46.08v119.296c-191.488 0-347.136 155.648-347.136 347.136s155.648 347.136 347.136 347.136 347.136-155.648 347.136-347.136H977.92c0 256.512-208.896 465.408-465.92 465.408z&quot; fill=&quot;#1296db&quot; p-id=&quot;3904&quot;&gt;&lt;/path&gt;&lt;path d=&quot;M512 150.528C312.32 150.528 150.528 312.32 150.528 512S312.32 873.472 512 8 [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 &lt;svg viewBox=&quot;-8 -8 40 40&quot;&gt;&lt;path fill=&quot;#000000&quot; d=&quot;M12 4.5a7.5 7.5 0 1 0 0 15a7.5 7.5 0 0 0 0-15M1.5 12C1.5 6.201 6.201 1.5 12 1.5S22.5 6.201 22.5 12S17.799 22.5 12 22.5S1.5 17.799 1.5 12&quot; fill-opacity=&quot;.1&quot;/&gt;&lt;path fill=&quot;#1677ff&quot; d=&quot;M12 4.5a7.46 7.46 0 0 0-5.187 2.083a1.5 1.5 0 0 1-2.075-2.166A10.46 10.46 0 0 1 12 1.5a1.5 1.5 0 0 1 0 3&quot;/&gt;&lt;/svg&gt; 的本地化字符串。
/// </summary>
internal static string Spin {
get {
@@ -509,13 +493,7 @@ namespace Demo {
}
/// <summary>
/// 查找类似 &lt;svg width=&quot;196px&quot; height=&quot;116px&quot; viewBox=&quot;0 0 196 116&quot; version=&quot;1.1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;
/// &lt;title&gt;编组 6&lt;/title&gt;
/// &lt;defs&gt;
/// &lt;path d=&quot;M5.84,3.5 L2.16,3.5 C2.0715,3.5 2,3.517875 2,3.54 L2,4.46 C2,4.482125 2.0715,4.5 2.16,4.5 L5.84,4.5 C5.9285,4.5 6,4.482125 6,4.46 L6,3.54 C6,3.517875 5.9285,3.5 5.84,3.5 Z&quot; id=&quot;path-1&quot;&gt;&lt;/path&gt;
/// &lt;/defs&gt;
/// &lt;g id=&quot;组件骨架图更新_202311&quot; stroke=&quot;none&quot; stroke-width=&quot;1&quot; fill=&quot;none&quot; fill-rule=&quot;evenodd&quot;&gt;
/// &lt;g id=&quot; [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// 查找类似 &lt;svg viewBox=&quot;0 0 196 116&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;&lt;defs&gt;&lt;path d=&quot;M5.84,3.5 L2.16,3.5 C2.0715,3.5 2,3.517875 2,3.54 L2,4.46 C2,4.482125 2.0715,4.5 2.16,4.5 L5.84,4.5 C5.9285,4.5 6,4.482125 6,4.46 L6,3.54 C6,3.517875 5.9285,3.5 5.84,3.5 Z&quot; id=&quot;path-1&quot;&gt;&lt;/path&gt;&lt;/defs&gt;&lt;g id=&quot;组件骨架图更新_202311&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(-885.000000, -2421.000000)&quot;&gt;&lt;g id=&quot;编组-6&quot; transform=&quot;translate(885.000000, 2421.000000)&quot;&gt;&lt;rect id=&quot;R [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string Transfer {
get {

File diff suppressed because one or more lines are too long

View File

@@ -257,11 +257,12 @@ namespace AntdUI
OnPropertyChanged(nameof(Shape));
}
}
TButtonDisplayStyle displayStyle = TButtonDisplayStyle.Default;
/// <summary>
/// 指定显示图像还是文本
/// </summary>
TButtonDisplayStyle displayStyle = TButtonDisplayStyle.ImageAndText;
[Description("指定显示图像还是文本"), Category("外观"), DefaultValue(TButtonDisplayStyle.ImageAndText)]
[Description("指定显示图像还是文本"), Category("外观"), DefaultValue(TButtonDisplayStyle.Default)]
public TButtonDisplayStyle DisplayStyle
{
get => displayStyle;
@@ -273,6 +274,7 @@ namespace AntdUI
OnPropertyChanged(nameof(DisplayStyle));
}
}
TTypeMini type = TTypeMini.Default;
/// <summary>
/// 类型
@@ -1519,10 +1521,7 @@ namespace AntdUI
}
bool has_loading = loading && LoadingValue > -1;
var font_size = g.MeasureText(text ?? Config.NullText, Font);
bool show_icon = displayStyle == TButtonDisplayStyle.Image || displayStyle == TButtonDisplayStyle.ImageAndText;
bool show_text = displayStyle == TButtonDisplayStyle.Text || displayStyle == TButtonDisplayStyle.ImageAndText;
text = show_text ? text : null;
if (text == null)
if (text == null || displayStyle == TButtonDisplayStyle.Image)
{
//没有文字
var rect = GetIconRectCenter(font_size, rect_read);
@@ -1548,58 +1547,77 @@ namespace AntdUI
else
{
if (textMultiLine && font_size.Width > rect_read.Width) font_size.Width = rect_read.Width;
bool has_left = has_loading || HasIcon, has_right = showArrow;
Rectangle rect_text;
if ((has_left || has_right) && show_icon)
if (displayStyle == TButtonDisplayStyle.Default)
{
if (has_left && has_right)
bool has_left = has_loading || HasIcon, has_right = showArrow;
if (has_left || has_right)
{
rect_text = RectAlignLR(g, textLine, textMultiLine, Font, iconPosition, iconratio, icongap, font_size, rect_read, out var rect_l, out var rect_r);
if (has_loading)
if (has_left && has_right)
{
float loading_size = rect_l.Height * .14F;
using (var brush = new Pen(color, loading_size))
{
brush.StartCap = brush.EndCap = LineCap.Round;
g.DrawArc(brush, rect_l, AnimationLoadingValue, LoadingValue * 360F);
}
}
else PaintIcon(g, color, rect_l, true, enabled);
rect_text = RectAlignLR(g, textLine, textMultiLine, Font, iconPosition, iconratio, icongap, font_size, rect_read, out var rect_l, out var rect_r);
PaintTextArrow(g, rect_r, color);
}
else if (has_left)
{
rect_text = RectAlignL(g, textLine, textMultiLine, textCenterHasIcon, Font, iconPosition, iconratio, icongap, font_size, rect_read, out var rect_l);
if (has_loading)
{
float loading_size = rect_l.Height * .14F;
using (var brush = new Pen(color, loading_size))
if (has_loading)
{
brush.StartCap = brush.EndCap = LineCap.Round;
g.DrawArc(brush, rect_l, AnimationLoadingValue, LoadingValue * 360F);
float loading_size = rect_l.Height * .14F;
using (var brush = new Pen(color, loading_size))
{
brush.StartCap = brush.EndCap = LineCap.Round;
g.DrawArc(brush, rect_l, AnimationLoadingValue, LoadingValue * 360F);
}
}
else PaintIcon(g, color, rect_l, true, enabled);
PaintTextArrow(g, rect_r, color);
}
else if (has_left)
{
rect_text = RectAlignL(g, textLine, textMultiLine, textCenterHasIcon, Font, iconPosition, iconratio, icongap, font_size, rect_read, out var rect_l);
if (has_loading)
{
float loading_size = rect_l.Height * .14F;
using (var brush = new Pen(color, loading_size))
{
brush.StartCap = brush.EndCap = LineCap.Round;
g.DrawArc(brush, rect_l, AnimationLoadingValue, LoadingValue * 360F);
}
}
else PaintIcon(g, color, rect_l, true, enabled);
}
else
{
rect_text = RectAlignR(g, textLine, textMultiLine, Font, iconPosition, iconratio, icongap, font_size, rect_read, out var rect_r);
PaintTextArrow(g, rect_r, color);
}
else PaintIcon(g, color, rect_l, true, enabled);
}
else
{
rect_text = RectAlignR(g, textLine, textMultiLine, Font, iconPosition, iconratio, icongap, font_size, rect_read, out var rect_r);
PaintTextArrow(g, rect_r, color);
int sps = (int)(font_size.Height * .4F), sps2 = sps * 2;
rect_text = new Rectangle(rect_read.X + sps, rect_read.Y + sps, rect_read.Width - sps2, rect_read.Height - sps2);
PaintTextAlign(rect_read, ref rect_text);
}
}
else
{
int sps = (int)(font_size.Height * .4F), sps2 = sps * 2;
rect_text = new Rectangle(rect_read.X + sps, rect_read.Y + sps, rect_read.Width - sps2, rect_read.Height - sps2);
PaintTextAlign(rect_read, ref rect_text);
}
if (show_text)
{
g.DrawText(text, Font, color, rect_text, stringFormat);
if (has_loading)
{
rect_text = RectAlignL(g, textLine, textMultiLine, textCenterHasIcon, Font, iconPosition, iconratio, icongap, font_size, rect_read, out var rect_l);
float loading_size = rect_l.Height * .14F;
using (var brush = new Pen(color, loading_size))
{
brush.StartCap = brush.EndCap = LineCap.Round;
g.DrawArc(brush, rect_l, AnimationLoadingValue, LoadingValue * 360F);
}
}
else
{
int sps = (int)(font_size.Height * .4F), sps2 = sps * 2;
rect_text = new Rectangle(rect_read.X + sps, rect_read.Y + sps, rect_read.Width - sps2, rect_read.Height - sps2);
PaintTextAlign(rect_read, ref rect_text);
}
}
g.DrawText(text, Font, color, rect_text, stringFormat);
}
}

View File

@@ -21,7 +21,6 @@ using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.IO;
using System.Windows.Forms;
using System.Windows.Forms.Design;
@@ -294,7 +293,7 @@ namespace AntdUI
int height = rectButtons.Height - (btn.SwitchMode ? 12 : 4);
int space = (rectButtons.Height - height) / 2;
bx -= space;
int? width= btn.Width;
int? width = btn.Width;
if (width == null)
{
bool emptyIcon = string.IsNullOrEmpty(btn.IconSvg) && btn.Icon == null;
@@ -309,7 +308,7 @@ namespace AntdUI
btn.SetRect(g, rectItem, Font.Height, 0, rectItem.Height - 8);
bx -= (width.Value + space);
}
}
Rectangle Rect;
if (it.Full)
@@ -612,7 +611,7 @@ namespace AntdUI
foreach (var btn in item.buttons)
{
if (btn.Show == false) continue;
if (btn.EditType!= EButtonEditTypes.Switch)
if (btn.EditType != EButtonEditTypes.Switch)
{
if (btn.EditType == EButtonEditTypes.Input || btn.EditType == EButtonEditTypes.Custom) continue;
@@ -783,7 +782,7 @@ namespace AntdUI
return;
}
btn.AnimationClick = false;
if(btn.EditType!= EButtonEditTypes.Button) btn.Select = true;
if (btn.EditType != EButtonEditTypes.Button) btn.Select = true;
OnButtonClickChanged(item, btn);
@@ -847,7 +846,7 @@ namespace AntdUI
if (items == null || items.Count == 0) return;
foreach (var it in items)
{
IUSelect(it);
IUSelect(it);
}
}
public void IUSelect(CollapseItem item)
@@ -860,7 +859,7 @@ namespace AntdUI
}
#endregion
#region
#region
internal class CollapseDesigner : ParentControlDesigner
{
@@ -995,7 +994,7 @@ namespace AntdUI
PARENT?.LoadLayout();
if (!value) Location = new Point(-Width, -Height);
}
}
}

View File

@@ -811,24 +811,24 @@ namespace AntdUI
/// <summary>
/// 默认CheckButton
/// </summary>
Default=0,
Default = 0,
/// <summary>
/// 开关模式。同等于SwitchMode=true
/// </summary>
Switch=1,
Switch = 1,
/// <summary>
/// 文本编辑模式
/// </summary>
Input=2,
Input = 2,
/// <summary>
/// 自定义继承自IControl的编辑器
/// </summary>
Custom=3,
Custom = 3,
/// <summary>
/// 正常按钮,按下后弹起
/// </summary>
Button=4,
Button = 4,
}
[DefaultEvent(nameof(TextChanged))]
[DefaultProperty(nameof(EditType))]
@@ -888,7 +888,7 @@ namespace AntdUI
set
{
if (m_editType == value) return;
m_editType = value;
Invalidate();
OnCreateEdit();
@@ -962,7 +962,7 @@ namespace AntdUI
{
if (_checked == value) return;
_checked = value;
if (PARENT == null || PARENTITEM == null) return;
if (PARENT == null || PARENTITEM == null) return;
try
{
ThreadCheck?.Dispose();
@@ -971,7 +971,7 @@ namespace AntdUI
AnimationCheck = true;
if (value)
{
ThreadCheck = new ITask((Collapse)this.PARENT, () =>
ThreadCheck = new ITask((Collapse)PARENT, () =>
{
AnimationCheckValue = AnimationCheckValue.Calculate(0.1F);
if (AnimationCheckValue > 1) { AnimationCheckValue = 1F; return false; }
@@ -985,7 +985,7 @@ namespace AntdUI
}
else
{
ThreadCheck = new ITask((Collapse)this.PARENT, () =>
ThreadCheck = new ITask((Collapse)PARENT, () =>
{
AnimationCheckValue = AnimationCheckValue.Calculate(-0.1F);
if (AnimationCheckValue <= 0) { AnimationCheckValue = 0F; return false; }
@@ -1026,7 +1026,7 @@ namespace AntdUI
AnimationHover = true;
if (value)
{
ThreadHover = new ITask((Collapse)this.PARENT, () =>
ThreadHover = new ITask((Collapse)PARENT, () =>
{
AnimationHoverValue = AnimationHoverValue.Calculate(0.1F);
if (AnimationHoverValue > 1) { AnimationHoverValue = 1F; return false; }
@@ -1040,7 +1040,7 @@ namespace AntdUI
}
else
{
ThreadHover = new ITask((Collapse)this.PARENT, () =>
ThreadHover = new ITask((Collapse)PARENT, () =>
{
AnimationHoverValue = AnimationHoverValue.Calculate(-0.1F);
if (AnimationHoverValue <= 0) { AnimationHoverValue = 0F; return false; }
@@ -1075,9 +1075,9 @@ namespace AntdUI
}
else
{
if (Edit != null && PARENT !=null)
if (Edit != null && PARENT != null)
{
((Collapse)PARENT).Invoke(new Action(() => { Edit.Location = rect.Location;Edit.Height = rect.Height; }));
((Collapse)PARENT).Invoke(new Action(() => { Edit.Location = rect.Location; Edit.Height = rect.Height; }));
}
@@ -1093,7 +1093,7 @@ namespace AntdUI
if (xc > 0) rect = new Rectangle(rect_read.X, rect_read.Y, rect_read.Width, rect_read.Height + xc);
}
Show = true;
Show = true;
}
internal bool Contains(int x, int y)
@@ -1109,76 +1109,79 @@ namespace AntdUI
return false;
}
}
internal void OnCreateEdit()
{
if (PARENT == null || PARENTITEM == null) return;
Collapse parent = (Collapse)PARENT;
if (Edit != null)
if (PARENT is Collapse parent)
{
if (parent.Controls.Contains(Edit)) parent.Controls.Remove(Edit);
Edit.TextChanged -= edit_TextChanged;
Edit.Click -= edit_GotFocus;
Edit.Dispose();
Edit = null;
}
switch (EditType)
{
case EButtonEditTypes.Input:
Input input = new Input()
{
Location = rect.Location,
TabIndex = parent.Controls.Count,
Size = rect.Size,
PrefixSvg = this.IconSvg,
PrefixFore = this.Fore,
PlaceholderText = this.Text,
Anchor = AnchorStyles.Top | AnchorStyles.Right,
IconRatio =ico_rect.Height==0|| rect.Height == 0 ? 1f : ico_rect.Height / rect.Height,
};
Edit = input;
break;
case EButtonEditTypes.Custom:
if (CustomInputEdit != null)
{
CollapseCustomInputEditEventArgs args = new CollapseCustomInputEditEventArgs();
CustomInputEdit(this, args);
if (args.Edit != null && args.Edit is IControl)
if (Edit != null)
{
if (parent.Controls.Contains(Edit)) parent.Controls.Remove(Edit);
Edit.TextChanged -= edit_TextChanged;
Edit.Click -= edit_GotFocus;
Edit.Dispose();
Edit = null;
}
switch (EditType)
{
case EButtonEditTypes.Input:
Input input = new Input()
{
args.Edit.Location = rect.Location;
args.Edit.Size = rect.Size;
args.Edit.Anchor = AnchorStyles.Top | AnchorStyles.Right;
Edit = args.Edit;
Location = rect.Location,
TabIndex = parent.Controls.Count,
Size = rect.Size,
PrefixSvg = IconSvg,
PrefixFore = Fore,
PlaceholderText = Text,
Anchor = AnchorStyles.Top | AnchorStyles.Right,
IconRatio = ico_rect.Height == 0 || rect.Height == 0 ? 1f : ico_rect.Height / rect.Height,
};
Edit = input;
break;
case EButtonEditTypes.Custom:
if (CustomInputEdit != null)
{
CollapseCustomInputEditEventArgs args = new CollapseCustomInputEditEventArgs();
CustomInputEdit(this, args);
if (args.Edit != null && args.Edit is IControl)
{
args.Edit.Location = rect.Location;
args.Edit.Size = rect.Size;
args.Edit.Anchor = AnchorStyles.Top | AnchorStyles.Right;
Edit = args.Edit;
}
}
}
break;
default:
break;
}
break;
default:
break;
}
if (Edit != null)
if (Edit != null)
{
Edit.TextChanged += edit_TextChanged;
Edit.Click += edit_GotFocus;
if (Select) Edit.Focus();
parent.Controls.Add(Edit);
}
}
}
private void edit_GotFocus(object? sender, EventArgs e)
{
if (PARENT is Collapse parent && PARENTITEM is CollapseItem item) parent.IUSelect(item);
}
private void edit_TextChanged(object? sender, EventArgs e)
{
if (TextChanged == null) return;
if (PARENT is Collapse parent && PARENTITEM is CollapseItem item)
{
Edit.TextChanged += edit_TextChanged;
Edit.Click += edit_GotFocus;
if (Select) Edit.Focus();
parent.Controls.Add(Edit);
if (sender is Input input) TextChanged(this, new CollapseEditChangedEventArgs(parent, item, input.Text));
else if (sender is IControl control) TextChanged(this, new CollapseEditChangedEventArgs(parent, item, control.Text));
}
}
private void edit_GotFocus(object sender, EventArgs e)
{
if (PARENT == null || PARENTITEM == null) return;
((Collapse)PARENT).IUSelect((CollapseItem)this.PARENTITEM);
}
private void edit_TextChanged(object sender, EventArgs e)
{
if(TextChanged != null) TextChanged(this,new CollapseEditChangedEventArgs(PARENT==null || !(PARENT is Collapse)?null: (Collapse)PARENT, PARENTITEM == null || !(PARENTITEM is CollapseItem) ? null : (CollapseItem)PARENTITEM, ((IControl)sender).Text));
}
}
public class CollapseGroupSub : ICollapseItem
{

View File

@@ -54,6 +54,12 @@ namespace AntdUI
[Description("自动宽度"), Category("外观"), DefaultValue(false)]
public bool AutoWidth { get; set; }
/// <summary>
/// 是否可以拖动位置
/// </summary>
[Description("是否可以拖动位置"), Category("行为"), DefaultValue(true)]
public bool DragMove { get; set; } = true;
#endregion
public LabelTime()
@@ -139,5 +145,10 @@ namespace AntdUI
ddd
};
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (DragMove && Parent is PageHeader header) header.IMouseDown(e);
}
}
}

View File

@@ -109,50 +109,12 @@ namespace AntdUI
OnPropertyChanged(nameof(Round));
}
}
bool focusedMark = false;
/// <summary>
/// 焦点标识块
/// </summary>
[Description("绘制焦点标识块"), Category("外观"), DefaultValue(false)]
public bool FocusedMark
{
get => focusedMark;
set
{
if (focusedMark == value) return;
focusedMark = value;
Invalidate();
OnPropertyChanged(nameof(FocusedMark));
}
}
bool flatten = false;
/// <summary>
/// Inline模式下无文本的平展模式
/// </summary>
[Description("Inline模式下无文本的平展模式"), Category("外观"), DefaultValue(false)]
public bool Flatten
{
get
{
if (Collapsed || Mode!= TMenuMode.Inline) return false;
return flatten;
}
set
{
if (flatten == value) return;
int width = this.Width;
flatten = value;
indent=!value;
if (IsHandleCreated)
{
ChangeList();
Invalidate();
}
OnPropertyChanged(nameof(Flatten));
}
}
public bool FocusedMark { get; set; }
/// <summary>
/// 色彩模式
@@ -232,6 +194,7 @@ namespace AntdUI
/// </summary>
[Description("触发下拉的行为"), Category("行为"), DefaultValue(Trigger.Hover)]
public Trigger Trigger { get; set; } = Trigger.Hover;
bool indent = false;
/// <summary>
/// 常规缩进
@@ -242,7 +205,7 @@ namespace AntdUI
get { return indent; }
set
{
if (indent == value) return;
if (indent == value) return;
indent = value;
if (IsHandleCreated)
{
@@ -563,7 +526,6 @@ namespace AntdUI
int ChangeList(Rectangle rect, Canvas g, MenuItem? Parent, MenuItemCollection items, ref int y, ref int icon_count, int height, int icon_size, int gap, int sp, int depth)
{
int collapsedWidth = 0, i = 0;
if (!Indent) depth = 0;
foreach (var it in items)
{
it.Index = i;
@@ -577,7 +539,7 @@ namespace AntdUI
int size = g.MeasureText(it.Text, it.Font ?? Font).Width + gap * 4 + icon_size + it.arr_rect.Width;
if (size > collapsedWidth) collapsedWidth = size;
y += height + sp;
if (mode == TMenuMode.Inline && it.CanExpand)
if ((mode == TMenuMode.Inline || mode == TMenuMode.InlineNoText) && it.CanExpand)
{
if (!collapsed)
{
@@ -864,7 +826,7 @@ namespace AntdUI
{
using (var brush = new SolidBrush(fore))
{
if (!Flatten) g.DrawText(it.Text, it.Font ?? Font, brush, it.txt_rect, SL);
if (mode != TMenuMode.InlineNoText) g.DrawText(it.Text, it.Font ?? Font, brush, it.txt_rect, SL);
if (FocusedMark) //增加焦点块
{
int fh = it.rect.Height - (it.rect.Height / 3);
@@ -872,7 +834,6 @@ namespace AntdUI
g.Fill(brush, rectFocused);
}
}
PaintIcon(g, it, fore);
}
void PaintTextIconExpand(Canvas g, MenuItem it, Color fore)
@@ -896,8 +857,12 @@ namespace AntdUI
}
}
}
if (!Flatten) g.DrawText(it.Text, it.Font ?? Font, fore, it.txt_rect, SL);
PaintIcon(g, it, fore);
if (mode == TMenuMode.InlineNoText) PaintIcon(g, it, fore);
else
{
g.DrawText(it.Text, it.Font ?? Font, fore, it.txt_rect, SL);
PaintIcon(g, it, fore);
}
}
void PaintIcon(Canvas g, MenuItem it, Color fore)
{
@@ -1093,7 +1058,6 @@ namespace AntdUI
if (collapsed)
{
int i = 0, hoveindex = -1;
foreach (var it in items)
{
if (it.show)
@@ -1128,14 +1092,11 @@ namespace AntdUI
subForm = new LayeredFormMenuDown(this, radius, rect, it.items);
subForm.Show(this);
}
else if (it.Text != null)
{
ShowTooltip(it, rect);
}
else if (it.Text != null) ShowTooltip(it, rect);
}
}
}
else if (mode == TMenuMode.Inline)
else if (mode == TMenuMode.Inline || mode == TMenuMode.InlineNoText)
{
foreach (var it in items) IMouseMove(it, e.X, e.Y, ref count, ref hand);
}
@@ -1185,7 +1146,7 @@ namespace AntdUI
}
else ILeave();
}
private void ShowTooltip(MenuItem it,Rectangle rect)
void ShowTooltip(MenuItem it, Rectangle rect)
{
if (it.Text == null) return;
if (tooltipForm == null)
@@ -1199,17 +1160,18 @@ namespace AntdUI
}
else tooltipForm.SetText(rect, it.Text);
}
void IMouseMove(MenuItem it, int x, int y, ref int count, ref int hand)
{
if (it.show)
{
if (it.Contains(x, y, 0, ScrollBar.Value, out var change))
{
if(flatten)
if (mode == TMenuMode.InlineNoText)
{
Point location = PointToScreen(it.rect.Location);
location.Y += it.rect.Height / 2;
ShowTooltip(it,new Rectangle(location,new Size(it.rect.Width,rect_r.Height)));
ShowTooltip(it, new Rectangle(location, new Size(it.rect.Width, rect_r.Height)));
}
hand++;
}
@@ -2027,12 +1989,7 @@ namespace AntdUI
ico_rect = new Rectangle(_rect.X + gap, _rect.Y + (_rect.Height - icon_size) / 2, icon_size, icon_size);
txt_rect = new Rectangle(ico_rect.X + ico_rect.Width + gap, _rect.Y, _rect.Width - (ico_rect.Width + gap * 2), _rect.Height);
}
if (PARENT!=null && PARENT.Flatten)
{
arr_rect = new Rectangle(_rect.Right - ico_rect.Height+4, _rect.Y + (_rect.Height - ico_rect.Height) / 2, ico_rect.Height, ico_rect.Height);
}
else
arr_rect = new Rectangle(_rect.Right - ico_rect.Height - (int)(ico_rect.Height * 0.9F), _rect.Y + (_rect.Height - ico_rect.Height) / 2, ico_rect.Height, ico_rect.Height);
arr_rect = new Rectangle(_rect.Right - ico_rect.Height - (int)(ico_rect.Height * 0.9F), _rect.Y + (_rect.Height - ico_rect.Height) / 2, ico_rect.Height, ico_rect.Height);
}
else
{

View File

@@ -1208,6 +1208,7 @@ namespace AntdUI
base.OnMouseLeave(e);
}
internal void IMouseDown(MouseEventArgs e) => OnMouseDown(e);
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)

View File

@@ -352,11 +352,13 @@ namespace AntdUI
{
var size = g.MeasureText(it.Text, Font, 0, sf);
int tabWidth;
if (it.HasIcon) {
if (it.HasIcon)
{
if (it.ShowClose) tabWidth = size.Width + paddx2 + gap2 + ico_size + close_size;
else tabWidth = size.Width + paddx2 + gap2 + ico_size;
}
else {
else
{
if (it.ShowClose) tabWidth = size.Width + paddx2 + gap + close_size;
else tabWidth = size.Width + paddx2;
}
@@ -380,11 +382,13 @@ namespace AntdUI
int max = (int)Math.Round(mw * dirb[i]);
if (dir[i][1] > max)
{
if (it.HasIcon) {
if (it.HasIcon)
{
if (it.ShowClose) dir[i][0] = max - (paddx2 + gap2 + ico_size + close_size);
else dir[i][0] = max - (paddx2 + gap2 + ico_size);
}
else {
else
{
if (it.ShowClose) dir[i][0] = max - (paddx2 + gap + close_size);
else dir[i][0] = max - paddx2;
}
@@ -416,7 +420,7 @@ namespace AntdUI
var _rect_text = new Rectangle(x + ico_size + gap, _rect.Y, textSize[0], _rect.Height);
it.RectText = _rect_text;
it.RectTextFull = new Rectangle(_rect_text.X, _rect_text.Y, textSize[2], _rect_text.Height);
if (it.ShowClose)
{
var _rect_close = new Rectangle(x + ico_size + gap2 + textSize[0], close_y, close_size, close_size);
@@ -428,7 +432,7 @@ namespace AntdUI
else
{
var _rect_text = new Rectangle(x + ico_size + gap, _rect.Y, textSize[0], _rect.Height);
if (it.ShowClose)
{
var _rect_close = new Rectangle(x + ico_size + gap2 + textSize[0], close_y, close_size, close_size);
@@ -468,7 +472,7 @@ namespace AntdUI
var _rect_text = new Rectangle(_rect.X + paddx, _rect.Y, textSize[0], _rect.Height);
it.RectText = _rect_text;
it.RectTextFull = new Rectangle(_rect_text.X, _rect_text.Y, textSize[2], _rect_text.Height);
if (it.ShowClose)
{
var _rect_close = new Rectangle(_rect.X + paddx + gap + textSize[0], close_y, close_size, close_size);
@@ -660,7 +664,7 @@ namespace AntdUI
void DrawCloseButton(Canvas g, TagTabItem tab, Color color, int radius)
{
if (!tab.ShowClose) return;
if (tab.HoverClose)
{
using (var path = tab.RectClose.RoundPath(radius))

View File

@@ -1,4 +1,4 @@
// COPYRIGHT (C) Tom. ALL RIGHTS RESERVED.
// COPYRIGHT (C) Tom. ALL RIGHTS RESERVED.
// THE AntdUI PROJECT IS AN WINFORM LIBRARY LICENSED UNDER THE Apache-2.0 License.
// LICENSED UNDER THE Apache License, VERSION 2.0 (THE "License")
// YOU MAY NOT USE THIS FILE EXCEPT IN COMPLIANCE WITH THE License.
@@ -113,8 +113,7 @@ namespace AntdUI
if (cell.ROW.Expand) rows_Expand.Remove(cell.ROW.RECORD);
else rows_Expand.Add(cell.ROW.RECORD);
ExpandChanged?.Invoke(this, new TableExpandEventArgs(cell.ROW.RECORD, !cell.ROW.Expand));
LoadLayout();
InvalidateRow(i_row);
if (LoadLayout()) Invalidate();
return;
}
MouseDownRow(e, it, it.cells[i_cel], r_x, r_y, i_row, i_cel, column);
@@ -597,9 +596,7 @@ namespace AntdUI
foreach (RowTemplate it in rows)
{
if (it.IsColumn) continue;
bool oldHover = it.Hover;
it.Hover = false;
if (oldHover) InvalidateRow(it.INDEX);
foreach (var cel_tmp in it.cells)
{
if (cel_tmp is TCellSort sort) sort.Hover = false;
@@ -654,15 +651,11 @@ namespace AntdUI
sort.Hover = sort.Contains(r_x, r_y);
if (sort.Hover) countmove++;
}
bool oldHover = rows[i].Hover;
rows[i].Hover = true;
if (!oldHover) InvalidateRow(i);
}
else
{
bool oldHover = rows[i].Hover;
rows[i].Hover = false;
if (oldHover) InvalidateRow(i);
foreach (var cel_tmp in rows[i].cells)
{
if (cel_tmp is TCellSort sort) sort.Hover = false;
@@ -1136,9 +1129,7 @@ namespace AntdUI
if (rows == null || inEditMode) return;
foreach (var it in rows)
{
bool oldHover = it.Hover;
it.Hover = false;
if (oldHover) InvalidateRow(it.INDEX);
foreach (var cel in it.cells)
{
if (cel is TCellSort sort) sort.Hover = false;

View File

@@ -27,14 +27,6 @@ namespace AntdUI
{
partial class Table
{
// 替代全表Invalidate(),只重绘变化的区域
public void InvalidateRow(int rowIndex)
{
if (rows == null || rowIndex < 0 || rowIndex >= rows.Length) return;
var row = rows[rowIndex];
if (row.SHOW) Invalidate(new Rectangle(0, row.RECT.Y - ScrollBar.ValueY, Width, row.RECT.Height));
}
protected override void OnDraw(DrawEventArgs e)
{
var g = e.Canvas;
@@ -75,6 +67,7 @@ namespace AntdUI
clipath = Helper.RoundPath(rect_divider, _radius, true, true, false, false);
g.SetClip(clipath);
}
else g.SetClip(rect_divider);
if (fixedHeader)
{
int showIndex = 0;
@@ -90,10 +83,7 @@ namespace AntdUI
else
{
int y = it.RECT.Y - sy, b = it.RECT.Bottom - sy;
// 严格判断行是否在可视区域内
it.SHOW = it.ShowExpand && it.Type == RowType.None &&
(it.RECT.Y >= sy && it.RECT.Y <= sy + rect_read.Height ||
it.RECT.Bottom >= sy && it.RECT.Bottom <= sy + rect_read.Height);
it.SHOW = it.ShowExpand && it.Type == RowType.None && (it.RECT.Y >= sy && it.RECT.Y <= sy + rect_read.Height || it.RECT.Bottom >= sy && it.RECT.Bottom <= sy + rect_read.Height);
if (it.SHOW) shows.Add(new StyleRow(it, SetRowStyle?.Invoke(this, new TableSetRowStyleEventArgs(it.RECORD, it.INDEX, showIndex))));
}
showIndex++;
@@ -142,10 +132,7 @@ namespace AntdUI
}
else
{
// 严格判断行是否在可视区域内
it.SHOW = it.ShowExpand && it.Type == RowType.None &&
(it.RECT.Y >= sy && it.RECT.Y <= sy + rect_read.Height ||
it.RECT.Bottom >= sy && it.RECT.Bottom <= sy + rect_read.Height);
it.SHOW = it.ShowExpand && (it.Type == RowType.None || it.Type == RowType.Column) && (it.RECT.Y >= sy && it.RECT.Y <= sy + rect_read.Height || it.RECT.Bottom >= sy && it.RECT.Bottom <= sy + rect_read.Height);
if (it.SHOW) shows.Add(new StyleRow(it, SetRowStyle?.Invoke(this, new TableSetRowStyleEventArgs(it.RECORD, it.INDEX, showIndex))));
}
showIndex++;
@@ -196,6 +183,7 @@ namespace AntdUI
clipath = Helper.RoundPath(rect_divider, _radius);
g.SetClip(clipath);
}
else g.SetClip(rect_divider);
rows[0].SHOW = false;
int showIndex = 0;
for (int index_r = 1; index_r < rows.Length; index_r++)

View File

@@ -82,11 +82,7 @@ namespace AntdUI
ScrollBar.Clear();
ExtractHeaderFixed();
ExtractData();
if (LoadLayout())
{
// 数据源改变时,需要重绘整个表格
Invalidate();
}
if (LoadLayout()) Invalidate();
OnPropertyChanged(nameof(DataSource));
}
}
@@ -482,17 +478,7 @@ namespace AntdUI
{
if (rowSelectedBg == value) return;
rowSelectedBg = value;
if (selectedIndex.Length > 0 && rows != null)
{
foreach (int index in selectedIndex)
{
InvalidateRow(index);
}
}
else if (selectedIndex.Length > 0)
{
Invalidate();
}
if (selectedIndex.Length > 0) Invalidate();
OnPropertyChanged(nameof(RowSelectedBg));
}
}
@@ -510,17 +496,7 @@ namespace AntdUI
{
if (rowSelectedFore == value) return;
rowSelectedFore = value;
if (selectedIndex.Length > 0 && rows != null)
{
foreach (int index in selectedIndex)
{
InvalidateRow(index);
}
}
else if (selectedIndex.Length > 0)
{
Invalidate();
}
if (selectedIndex.Length > 0) Invalidate();
OnPropertyChanged(nameof(RowSelectedFore));
}
}
@@ -642,21 +618,7 @@ namespace AntdUI
{
if (SetIndex(value))
{
// 优化:只重绘变化的行
if (rows != null)
{
// 重绘之前选中的行
foreach (var idx in selectedIndex)
{
if (idx >= 0 && idx < rows.Length) InvalidateRow(idx);
}
// 重绘新选中的行
if (value >= 0 && value < rows.Length) InvalidateRow(value);
}
else
{
Invalidate();
}
Invalidate();
OnPropertyChanged(nameof(SelectedIndex));
SelectIndexChanged?.Invoke(this, EventArgs.Empty);
}
@@ -675,32 +637,8 @@ namespace AntdUI
set
{
if (selectedIndex == value) return;
// 优化:只重绘变化的行
if (rows != null)
{
// 保存旧的选中行索引,用于后面重绘
var oldSelectedIndex = selectedIndex;
selectedIndex = value;
// 重绘之前选中的行
foreach (var idx in oldSelectedIndex)
{
if (idx >= 0 && idx < rows.Length) InvalidateRow(idx);
}
// 重绘新选中的行
foreach (var idx in selectedIndex)
{
if (idx >= 0 && idx < rows.Length) InvalidateRow(idx);
}
}
else
{
selectedIndex = value;
Invalidate();
}
selectedIndex = value;
Invalidate();
OnPropertyChanged(nameof(SelectedIndexs));
SelectIndexChanged?.Invoke(this, EventArgs.Empty);
}
@@ -840,11 +778,7 @@ namespace AntdUI
ExtractHeaderFixed();
if (dataSource == null || dataSource is DataTable || dataSource is IList) ExtractData();
base.Refresh();
if (LoadLayout())
{
// 全部展开或折叠时,需要重绘整个表格
Invalidate();
}
if (LoadLayout()) Invalidate();
}
/// <summary>
@@ -1280,11 +1214,7 @@ namespace AntdUI
rows_Expand.Clear();
}
}
if (LoadLayout())
{
// 全部展开或折叠时,需要重绘整个表格
Invalidate();
}
if (LoadLayout()) Invalidate();
}
/// <summary>
@@ -1309,23 +1239,7 @@ namespace AntdUI
}
else return;
}
if (LoadLayout())
{
if (rows != null)
{
// 查找对应的行索引并只重绘该行
for (int i = 0; i < rows.Length; i++)
{
if (rows[i].RECORD == record)
{
InvalidateRow(i);
return;
}
}
}
// 如果找不到对应的行或rows为空则重绘整个表格
Invalidate();
}
if (LoadLayout()) Invalidate();
}
#endregion

View File

@@ -600,17 +600,17 @@ namespace AntdUI
protected override void OnMouseWheel(MouseEventArgs e)
{
base.OnMouseWheel(e);
// 确定滚动方向和步长
int scrollDelta = e.Delta > 0 ? -1 : 1;
// 检查鼠标是否在源列表区域
if (sourceRect.Contains(e.Location))
{
// 计算最大滚动偏移量
int visibleItems = (sourceRect.Height - 80) / ItemHeight; // 减去标题、搜索框和全选区域的高度
int maxScrollOffset = Math.Max(0, sourceFilteredItems.Count - visibleItems);
// 更新滚动偏移量
sourceScrollOffset = Math.Max(0, Math.Min(maxScrollOffset, sourceScrollOffset + scrollDelta));
Invalidate();
@@ -621,7 +621,7 @@ namespace AntdUI
// 计算最大滚动偏移量
int visibleItems = (targetRect.Height - 80) / ItemHeight; // 减去标题、搜索框和全选区域的高度
int maxScrollOffset = Math.Max(0, targetFilteredItems.Count - visibleItems);
// 更新滚动偏移量
targetScrollOffset = Math.Max(0, Math.Min(maxScrollOffset, targetScrollOffset + scrollDelta));
Invalidate();
@@ -727,12 +727,12 @@ namespace AntdUI
// 计算列表区域
Rectangle rect = isSource ? sourceRect : targetRect;
int contentTop = rect.Y + 40; // 标题高度
// 如果显示搜索框,检查是否点击了搜索框
//if (ShowSearch)
//{
// var searchRect = new Rectangle(rect.X + 10, contentTop, rect.Width - 20, 30);
// if (searchRect.Contains(location))
// {
// // 弹出输入框让用户输入搜索文本
@@ -748,7 +748,7 @@ namespace AntdUI
// // 添加到控件并聚焦
// Controls.Add(inputBox);
// inputBox.Focus();
// // 添加文本变更事件处理
// inputBox.TextChanged += (sender, e) =>
// {
@@ -760,14 +760,14 @@ namespace AntdUI
// {
// targetSearchText = inputBox.Text;
// }
// // 应用过滤
// ApplyFilter();
// // 触发搜索事件
// OnSearch(new SearchEventArgs(inputBox.Text, isSource));
// };
// // 添加失去焦点事件处理
// inputBox.LostFocus += (sender, e) =>
// {
@@ -776,25 +776,25 @@ namespace AntdUI
// Invalidate();
// };
// }
// return;
// }
// contentTop += 40;
//}
// 如果显示全选复选框,检查是否点击了全选复选框
if (ShowSelectAll)
{
var checkboxRect = new Rectangle(rect.X + 10, contentTop, 20, 20);
var checkboxTextRect = new Rectangle(rect.X + 35, contentTop, rect.Width - 45, 20);
var selectAllRect = new Rectangle(rect.X + 10, contentTop, rect.Width - 20, 20);
if (selectAllRect.Contains(location))
{
// 切换全选状态
bool newSelectAllState = isSource ? !sourceSelectAll : !targetSelectAll;
// 更新全选状态
if (isSource)
{
@@ -814,35 +814,35 @@ namespace AntdUI
item.Selected = newSelectAllState;
}
}
Invalidate();
return;
}
contentTop += 30;
}
// 计算列表区域
int listHeight = rect.Height - (contentTop - rect.Y) - 10;
var listRect = new Rectangle(rect.X + 10, contentTop, rect.Width - 20, listHeight);
int visibleItems = listHeight / ItemHeight;
// 计算滚动条
bool showScrollbar = items.Count * ItemHeight > listHeight;
int scrollbarWidth = showScrollbar ? 6 : 0;
// 检查点击是否在列表项区域内
if (location.X >= listRect.X && location.X <= listRect.Right - scrollbarWidth)
{
// 计算点击的项索引
int clickedIndex = scrollOffset + (location.Y - listRect.Y) / ItemHeight;
// 确保索引有效
if (clickedIndex >= 0 && clickedIndex < items.Count)
{
// 切换选中状态
items[clickedIndex].Selected = !items[clickedIndex].Selected;
// 更新全选状态
if (isSource)
{
@@ -852,7 +852,7 @@ namespace AntdUI
{
targetSelectAll = items.All(i => i.Selected);
}
Invalidate();
}
}
@@ -1178,7 +1178,7 @@ namespace AntdUI
var buttonBackColor = ButtonBackColor ?? Style.Db.FillTertiary;
var buttonBackHover = ButtonBackHover ?? Style.Db.FillSecondary;
var buttonBackActive = ButtonBackActive ?? Style.Db.TextQuaternary;
;
;
var buttonBackDisable = ButtonBackDisable ?? Color.FromArgb(50, Style.Db.Text);
// 绘制向右按钮

View File

@@ -872,14 +872,14 @@ namespace AntdUI
public delegate void CollapseSwitchCheckedChangedEventHandler(object sender, CollapseSwitchCheckedChangedEventArgs e);
public class CollapseEditChangedEventArgs:VEventArgs<object>
public class CollapseEditChangedEventArgs : VEventArgs<object>
{
public CollapseEditChangedEventArgs(Collapse parent, CollapseItem parentItem, object value) : base(value)
{
Parent = parent;
ParentItem = parentItem;
}
public Collapse Parent { get; private set; }
public Collapse Parent { get; private set; }
public CollapseItem ParentItem { get; private set; }
}

View File

@@ -16,19 +16,12 @@
// CSDN: https://blog.csdn.net/v_132
// QQ: 17379620
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntdUI
{
public enum TButtonDisplayStyle
{
//None = 0,
Default = 0,
Text = 1,
Image = 2,
ImageAndText = 3
Image = 2
}
}
}

View File

@@ -34,6 +34,10 @@ namespace AntdUI
/// <summary>
/// 水平模式
/// </summary>
Horizontal
Horizontal,
/// <summary>
/// 内嵌模式(无文本)
/// </summary>
InlineNoText
}
}

View File

@@ -67,7 +67,12 @@ namespace AntdUI
/// </summary>
/// <param name="tb">垂直(上下)</param>
/// <param name="lr">水平(前后)</param>
public static StringFormat SF(StringAlignment tb = StringAlignment.Center, StringAlignment lr = StringAlignment.Center) => new StringFormat(StringFormat.GenericTypographic) { LineAlignment = tb, Alignment = lr };
public static StringFormat SF(StringAlignment tb = StringAlignment.Center, StringAlignment lr = StringAlignment.Center)
{
var sf = new StringFormat(StringFormat.GenericTypographic) { LineAlignment = tb, Alignment = lr };
sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
return sf;
}
/// <summary>
/// 文本布局(不换行)
@@ -77,7 +82,7 @@ namespace AntdUI
public static StringFormat SF_NoWrap(StringAlignment tb = StringAlignment.Center, StringAlignment lr = StringAlignment.Center)
{
var sf = new StringFormat(StringFormat.GenericTypographic) { LineAlignment = tb, Alignment = lr };
sf.FormatFlags |= StringFormatFlags.NoWrap;
sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap;
return sf;
}
@@ -86,7 +91,12 @@ namespace AntdUI
/// </summary>
/// <param name="tb">垂直(上下)</param>
/// <param name="lr">水平(前后)</param>
public static StringFormat SF_Ellipsis(StringAlignment tb = StringAlignment.Center, StringAlignment lr = StringAlignment.Center) => new StringFormat(StringFormat.GenericTypographic) { LineAlignment = tb, Alignment = lr, Trimming = StringTrimming.EllipsisCharacter };
public static StringFormat SF_Ellipsis(StringAlignment tb = StringAlignment.Center, StringAlignment lr = StringAlignment.Center)
{
var sf = new StringFormat(StringFormat.GenericTypographic) { LineAlignment = tb, Alignment = lr, Trimming = StringTrimming.EllipsisCharacter };
sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
return sf;
}
/// <summary>
/// 文本布局(超出省略号+不换行)
@@ -96,7 +106,7 @@ namespace AntdUI
public static StringFormat SF_ALL(StringAlignment tb = StringAlignment.Center, StringAlignment lr = StringAlignment.Center)
{
var sf = new StringFormat(StringFormat.GenericTypographic) { LineAlignment = tb, Alignment = lr, Trimming = StringTrimming.EllipsisCharacter };
sf.FormatFlags |= StringFormatFlags.NoWrap;
sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap;
return sf;
}