* UILineChart: 增加了鼠标移上绘制十字线颜色

This commit is contained in:
Sunny 2024-11-14 10:17:21 +08:00
parent c676e92fda
commit 4760de7dd1
2 changed files with 10 additions and 8 deletions

View File

@ -54,16 +54,14 @@
* 2023-11-22: V3.6.0
* 2024-07-01: V3.6.7 Y轴自定义坐标显示
* 2024-11-13: V3.7.2 线
* 2024-11-14: V3.7.2 线
******************************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Sunny.UI
{
@ -76,6 +74,10 @@ namespace Sunny.UI
[Description("鼠标移上绘制十字线样式"), Category("SunnyUI")]
public MouseLineType MouseLine { get; set; }
[DefaultValue(typeof(Color), "Red")]
[Description("鼠标移上绘制十字线颜色"), Category("SunnyUI")]
public Color MouseLineColor { get; set; } = Color.Red;
/// <summary>
/// 重载控件尺寸变更
/// </summary>
@ -300,14 +302,14 @@ namespace Sunny.UI
switch (MouseLine)
{
case MouseLineType.Horizontal:
g.DrawLine(Pens.Red, DrawRect.Left, MousePoint.Y, DrawRect.Right, MousePoint.Y);
g.DrawLine(MouseLineColor, DrawRect.Left + 1, MousePoint.Y, DrawRect.Right - 1, MousePoint.Y);
break;
case MouseLineType.Vertical:
g.DrawLine(Pens.Red, MousePoint.X, DrawRect.Top, MousePoint.X, DrawRect.Bottom);
g.DrawLine(MouseLineColor, MousePoint.X, DrawRect.Top + 1, MousePoint.X, DrawRect.Bottom - 1);
break;
case MouseLineType.Cross:
g.DrawLine(Pens.Red, DrawRect.Left, MousePoint.Y, DrawRect.Right, MousePoint.Y);
g.DrawLine(Pens.Red, MousePoint.X, DrawRect.Top, MousePoint.X, DrawRect.Bottom);
g.DrawLine(MouseLineColor, DrawRect.Left + 1, MousePoint.Y, DrawRect.Right - 1, MousePoint.Y);
g.DrawLine(MouseLineColor, MousePoint.X, DrawRect.Top + 1, MousePoint.X, DrawRect.Bottom - 1);
break;
}
}

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net8.0-windows;net6.0-windows;net472;net40</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<LangVersion>13.0</LangVersion>
<ProjectGuid>{AB1CB247-E20B-4CBE-B269-570ADDD96C53}</ProjectGuid>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Sunny.UI</RootNamespace>