From 48e2274861fa534a8f6238d89015d00c74a778e9 Mon Sep 17 00:00:00 2001 From: Sunny Date: Sun, 16 Jul 2023 20:41:30 +0800 Subject: [PATCH] =?UTF-8?q?*=20UITextBox:=20=E4=BF=AE=E5=A4=8D=E4=BA=86Ena?= =?UTF-8?q?bled=E4=B8=BAfalse=E6=97=B6=EF=BC=8CPasswordChar=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UIEdit.cs | 12 +++++++++--- SunnyUI/Controls/UITextBox.cs | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SunnyUI/Controls/UIEdit.cs b/SunnyUI/Controls/UIEdit.cs index 06bfb3b3..35cc246c 100644 --- a/SunnyUI/Controls/UIEdit.cs +++ b/SunnyUI/Controls/UIEdit.cs @@ -171,17 +171,23 @@ namespace Sunny.UI if (Text.IsValid() && !Enabled) { + string text = Text; + if (PasswordChar > 0) + { + text = PasswordChar.ToString().Repeat(text.Length); + } + if (TextAlign == HorizontalAlignment.Left) { - e.Graphics.DrawString(Text, Font, ForeDisableColor, new Rectangle(0, 0, Width, Height), ContentAlignment.MiddleLeft, -5, 0); + e.Graphics.DrawString(text, Font, ForeDisableColor, new Rectangle(0, 0, Width, Height), ContentAlignment.MiddleLeft, -5, 0); } else if (TextAlign == HorizontalAlignment.Right) { - e.Graphics.DrawString(Text, Font, ForeDisableColor, new Rectangle(0, 0, Width, Height), ContentAlignment.MiddleRight, 7, 0); + e.Graphics.DrawString(text, Font, ForeDisableColor, new Rectangle(0, 0, Width, Height), ContentAlignment.MiddleRight, 7, 0); } else { - e.Graphics.DrawString(Text, Font, ForeDisableColor, new Rectangle(0, 0, Width, Height), ContentAlignment.MiddleCenter, 1, 0); + e.Graphics.DrawString(text, Font, ForeDisableColor, new Rectangle(0, 0, Width, Height), ContentAlignment.MiddleCenter, 1, 0); } } } diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs index 8b86ee2b..572cc077 100644 --- a/SunnyUI/Controls/UITextBox.cs +++ b/SunnyUI/Controls/UITextBox.cs @@ -47,7 +47,8 @@ * 2023-02-07: V3.3.1 增加Tips小红点 * 2023-02-10: V3.3.2 有水印时,系统响应触摸屏增加了TouchPressClick属性,默认关闭 * 2023-06-14: V3.3.9 按钮图标位置修正 - * 2024-07-03: V3.3.9 增加Enabled为false时,可修改文字颜色 + * 2023-07-03: V3.3.9 增加Enabled为false时,可修改文字颜色 + * 2023-07-16: V3.4.0 修复了Enabled为false时,PasswordChar失效的问题 ******************************************************************************/ using System;