* 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.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)

View File

@ -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;

View File

@ -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();