diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 7ac44c16..c3803307 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI/Common/UControl.cs b/SunnyUI/Common/UControl.cs index 6586206e..16d0f0f0 100644 --- a/SunnyUI/Common/UControl.cs +++ b/SunnyUI/Common/UControl.cs @@ -25,7 +25,6 @@ using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -using System.IO; using System.Linq; using System.Reflection; using System.Windows.Forms; @@ -43,17 +42,14 @@ namespace Sunny.UI timer.Start(); } - public static Point LocationOnScreen(this Control ctrl) + public static Rectangle ScreenRectangle(this Control ctrl) { - Point point = new Point(0, 0); - do - { - point.Offset(ctrl.Location); - ctrl = ctrl.Parent; - } - while (ctrl != null); + return ctrl.RectangleToScreen(ctrl.ClientRectangle); + } - return point; + public static Point ScreenLocation(this Control ctrl) + { + return ctrl.PointToScreen(new Point(0, 0)); } public static Form RootForm(this Control ctrl) @@ -318,7 +314,7 @@ namespace Sunny.UI return list; } - + /// /// 查找包含接口名称的控件列表 /// diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index c22d903b..a54dfea7 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -24,6 +24,7 @@ * 2021-07-29: V3.0.5 增加多选行 * 2021-07-30: V3.0.5 选中项显示方角 * 2021-08-04: V3.0.5 增加Items变更的事件 + * 2021-12-29: V3.0.9 增加修改文字颜色 ******************************************************************************/ using System; @@ -421,6 +422,15 @@ namespace Sunny.UI } } + protected override void AfterSetForeColor(Color color) + { + base.AfterSetForeColor(color); + if (listbox != null) + { + listbox.ForeColor = color; + } + } + private int LastCount; private int lastBarValue = -1; diff --git a/SunnyUI/Forms/UIFormHelper.cs b/SunnyUI/Forms/UIFormHelper.cs index ebdac0ad..9742d96d 100644 --- a/SunnyUI/Forms/UIFormHelper.cs +++ b/SunnyUI/Forms/UIFormHelper.cs @@ -673,7 +673,7 @@ namespace Sunny.UI mask.Tag = baseForm; mask.Text = topmost.ToString(); - var pt = control.LocationOnScreen(); + var pt = control.ScreenLocation(); mask.Left = pt.X; mask.Top = pt.Y; mask.Show();