* UIIntegerUpDown: 修改编辑框字体与显示字体一致

* UIDoubleUpDown: 修改编辑框字体与显示字体一致
* UITextBox: AutoSize时根据字体自动调整控件高度
This commit is contained in:
Sunny 2024-08-27 10:12:05 +08:00
parent fcb55cbae4
commit 073c2dbf0b
4 changed files with 27 additions and 8 deletions

View File

@ -30,6 +30,7 @@
* 2023-01-28: V3.3.1 MouseLeave
* 2023-03-24: V3.3.3 ForbidInput属性使Inputable属性
* 2023-12-28: V3.6.2 Style时按钮颜色不一致
* 2024-08-27: V3.6.9
******************************************************************************/
using System;
@ -204,6 +205,7 @@ namespace Sunny.UI
if (!Inputable) return;
edit.Left = 1;
edit.Font = pnlValue.Font;
edit.Top = (pnlValue.Height - edit.Height) / 2;
edit.Width = pnlValue.Width - 2;
pnlColor = pnlValue.FillColor;

View File

@ -29,6 +29,7 @@
* 2023-01-28: V3.3.1 MouseLeave
* 2023-03-24: V3.3.3 ForbidInput属性使Inputable属性
* 2023-12-28: V3.6.2 Style时按钮颜色不一致
* 2024-08-27: V3.6.9
******************************************************************************/
using System;
@ -187,6 +188,7 @@ namespace Sunny.UI
if (!Inputable) return;
edit.Left = 1;
edit.Font = pnlValue.Font;
edit.Top = (pnlValue.Height - edit.Height) / 2;
edit.Width = pnlValue.Width - 2;
pnlColor = pnlValue.FillColor;

View File

@ -62,6 +62,7 @@
* 2024-06-11: V3.6.6
* 2024-08-12: V3.6.8
* 2024-08-26: V3.6.9
* 2024-08-27: V3.6.9 AutoSize时根据字体自动调整控件高度
******************************************************************************/
using System;
@ -90,7 +91,7 @@ namespace Sunny.UI
ShowText = false;
MinimumSize = new Size(1, 16);
edit.AutoSize = true;
edit.AutoSize = false;
edit.Top = (Height - edit.Height) / 2;
edit.Left = 4;
edit.Width = Width - 8;
@ -188,6 +189,17 @@ namespace Sunny.UI
set => edit.TouchPressClick = value;
}
private bool _autoSize = false;
public new bool AutoSize
{
get => _autoSize;
set
{
_autoSize = value;
SizeChange();
}
}
private UIButton tipsBtn;
public void SetTipsText(ToolTip toolTip, string text)
{
@ -732,14 +744,16 @@ namespace Sunny.UI
if (!multiline)
{
//if (Height < edit.Height + RectSize * 2 + 2)
//{
// NoNeedChange = true;
// Height = edit.Height + RectSize * 2 + 2;
// edit.Top = (Height - edit.Height) / 2;
// NoNeedChange = false;
//}
//单行显示
//AutoSize自动设置高度
if (Dock == DockStyle.None && AutoSize)
{
if (Height != edit.Height + 5)
Height = edit.Height + 5;
}
//根据字体大小编辑框垂直居中
if (edit.Top != (Height - edit.Height) / 2 + 1)
{
edit.Top = (Height - edit.Height) / 2 + 1;

View File

@ -32,6 +32,7 @@
* 2024-05-30: V3.6.6
* 2024-07-30: V3.6.8 showMask=true或者centerParent=false时以屏幕居中
* 2024-08-09: V3.6.8 TopMost参数true
* 2024-08-26: V3.6.9 ShowAskDialog2报错 #IAMA5A
******************************************************************************/
using System;