* UIListBox: 增加修改文字颜色

This commit is contained in:
Sunny 2021-12-29 17:16:06 +08:00
parent 7b7f378880
commit 513eaf959d
4 changed files with 18 additions and 12 deletions

Binary file not shown.

View File

@ -25,7 +25,6 @@ using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
@ -43,17 +42,14 @@ namespace Sunny.UI
timer.Start(); timer.Start();
} }
public static Point LocationOnScreen(this Control ctrl) public static Rectangle ScreenRectangle(this Control ctrl)
{ {
Point point = new Point(0, 0); return ctrl.RectangleToScreen(ctrl.ClientRectangle);
do }
{
point.Offset(ctrl.Location);
ctrl = ctrl.Parent;
}
while (ctrl != null);
return point; public static Point ScreenLocation(this Control ctrl)
{
return ctrl.PointToScreen(new Point(0, 0));
} }
public static Form RootForm(this Control ctrl) public static Form RootForm(this Control ctrl)
@ -318,7 +314,7 @@ namespace Sunny.UI
return list; return list;
} }
/// <summary> /// <summary>
/// 查找包含接口名称的控件列表 /// 查找包含接口名称的控件列表
/// </summary> /// </summary>

View File

@ -24,6 +24,7 @@
* 2021-07-29: V3.0.5 * 2021-07-29: V3.0.5
* 2021-07-30: V3.0.5 * 2021-07-30: V3.0.5
* 2021-08-04: V3.0.5 Items变更的事件 * 2021-08-04: V3.0.5 Items变更的事件
* 2021-12-29: V3.0.9
******************************************************************************/ ******************************************************************************/
using System; 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 LastCount;
private int lastBarValue = -1; private int lastBarValue = -1;

View File

@ -673,7 +673,7 @@ namespace Sunny.UI
mask.Tag = baseForm; mask.Tag = baseForm;
mask.Text = topmost.ToString(); mask.Text = topmost.ToString();
var pt = control.LocationOnScreen(); var pt = control.ScreenLocation();
mask.Left = pt.X; mask.Left = pt.X;
mask.Top = pt.Y; mask.Top = pt.Y;
mask.Show(); mask.Show();