* UICheckBoxGroup: 修复TitleTop为0时,条目显示错位的问题 #IB7STO

* UIRadioButtonGroup: 修复TitleTop为0时,条目显示错位的问题 #IB7STO
This commit is contained in:
Sunny 2024-11-29 10:59:06 +08:00
parent 98d280d9f0
commit 120dbf2151
2 changed files with 10 additions and 5 deletions

View File

@ -27,6 +27,7 @@
* 2023-11-07: V3.5.2 UICheckBoxGroup
* 2023-12-04: V3.6.1
* 2024-09-09: V3.7.0 #IAPY94
* 2024-11-29: V3.8.0 TitleTop为0时 #IB7STO
******************************************************************************/
using System;
@ -206,11 +207,13 @@ namespace Sunny.UI
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (TitleTop == 0 && Text.IsValid()) Text = "";
if (Items.Count == 0) return;
InitRects();
if (activeIndex >= 0 && CheckBoxRects.ContainsKey(activeIndex))
if (activeIndex >= 0 && CheckBoxRects.TryGetValue(activeIndex, out Rectangle boxRect))
{
e.Graphics.FillRectangle(hoverColor, CheckBoxRects[activeIndex]);
e.Graphics.FillRectangle(hoverColor, boxRect);
}
int startX = StartPos.X;

View File

@ -26,6 +26,7 @@
* 2023-11-09: V3.5.2 UIRadioButtonGroup
* 2023-12-04: V3.6.1
* 2024-09-09: V3.7.0 #IAPY94
* 2024-11-29: V3.8.0 TitleTop为0时 #IB7STO
******************************************************************************/
using System;
@ -132,12 +133,13 @@ namespace Sunny.UI
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (TitleTop == 0 && Text.IsValid()) Text = "";
if (Items.Count == 0) return;
InitRects();
if (activeIndex >= 0 && CheckBoxRects.ContainsKey(activeIndex))
if (activeIndex >= 0 && CheckBoxRects.TryGetValue(activeIndex, out Rectangle boxRect))
{
e.Graphics.FillRectangle(hoverColor, CheckBoxRects[activeIndex]);
e.Graphics.FillRectangle(hoverColor, boxRect);
}
int startX = StartPos.X;