From 8286051404bab1a47e2a8c06034031f989d36a4c Mon Sep 17 00:00:00 2001 From: Sunny Date: Fri, 19 Jan 2024 22:19:42 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIDropControl:=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=8F=AF=E4=BF=AE=E6=94=B9=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=8F=8A=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/DropItem/UIDropControl.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/SunnyUI/Controls/DropItem/UIDropControl.cs b/SunnyUI/Controls/DropItem/UIDropControl.cs index 02b0a07e..04843ece 100644 --- a/SunnyUI/Controls/DropItem/UIDropControl.cs +++ b/SunnyUI/Controls/DropItem/UIDropControl.cs @@ -31,6 +31,7 @@ * 2023-10-25: V3.5.1 修复在某些字体不显示下划线的问题 * 2023-10-26: V3.5.1 字体图标增加旋转角度参数SymbolRotate * 2023-12-18: V3.6.2 修复高度不随字体改变 + * 2024-01-19: V3.6.3 下拉按钮可修改大小及位置 ******************************************************************************/ using System; @@ -445,16 +446,27 @@ namespace Sunny.UI g.DrawString(Watermark, Font, WatermarkColor, ClientRectangle, TextAlignment, 5); } - g.FillRectangle(GetFillColor(), new Rectangle(Width - 27, Radius / 2, 26, Height - Radius)); + g.FillRectangle(GetFillColor(), new Rectangle(Width - Padding.Right, 2, Padding.Right - 1, Height - 4)); Color color = GetRectColor(); int symbol = dropSymbol; if (NeedDrawClearButton) { - g.DrawFontImage(261527, 24, color, new Rectangle(Width - 28, 0, 28, Height), -1, 1); + g.DrawFontImage(261527, SymbolSize, color, new Rectangle(Width - Padding.Right, 0, Padding.Right, Height), -1, 1); } else { - g.DrawFontImage(symbol, 24, color, new Rectangle(Width - 28, 0, 28, Height), 1, 0); + g.DrawFontImage(symbol, SymbolSize, color, new Rectangle(Width - Padding.Right, 0, Padding.Right, Height), 1, 0); + } + } + + private int symbolSize = 24; + public int SymbolSize + { + get => symbolSize; + set + { + symbolSize = value; + Invalidate(); } } @@ -605,7 +617,7 @@ namespace Sunny.UI DropDown?.Invoke(this, e); - if (fullControlSelect || MouseLocation.X > Width - 30) + if (fullControlSelect || MouseLocation.X > Width - Padding.Right) { ButtonClick?.Invoke(this, e); }