From f0161b479ee8a0197055f82b4e73f101611c794f Mon Sep 17 00:00:00 2001 From: Sunny Date: Fri, 18 Aug 2023 09:50:11 +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=8C=E5=AD=97=E4=BD=93=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E8=B0=83=E6=95=B4=E5=90=8E=EF=BC=8C=E6=96=87=E5=AD=97?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BD=8D=E7=BD=AE=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/UITextBox.cs | 13 +++++++++++-- SunnyUI/Controls/UIUserControl.cs | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs index 91ecf1ef..ba678a52 100644 --- a/SunnyUI/Controls/UITextBox.cs +++ b/SunnyUI/Controls/UITextBox.cs @@ -413,7 +413,16 @@ namespace Sunny.UI { base.OnEnabledChanged(e); edit.BackColor = GetFillColor(); - edit.Visible = Enabled; + edit.Visible = !styleCustomMode; + edit.Enabled = Enabled; + } + + protected override void SetStyleCustom(bool needRefresh = true) + { + base.SetStyleCustom(needRefresh); + edit.Visible = !styleCustomMode; + edit.Enabled = Enabled; + Invalidate(); } public override bool Focused => edit.Focused; @@ -1271,7 +1280,7 @@ namespace Sunny.UI e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor, new Rectangle(4 + symbolOffset.X, (Height - SymbolSize) / 2 + 1 + symbolOffset.Y, SymbolSize, SymbolSize), SymbolOffset.X, SymbolOffset.Y); } - if (Text.IsValid() && !Enabled) + if (styleCustomMode && Text.IsValid() && !Enabled) { string text = Text; if (PasswordChar > 0) diff --git a/SunnyUI/Controls/UIUserControl.cs b/SunnyUI/Controls/UIUserControl.cs index a20b93d8..260b1b6d 100644 --- a/SunnyUI/Controls/UIUserControl.cs +++ b/SunnyUI/Controls/UIUserControl.cs @@ -808,7 +808,7 @@ namespace Sunny.UI [Browsable(false)] public new bool AutoScroll { get; set; } = false; - protected void SetStyleCustom(bool needRefresh = true) + protected virtual void SetStyleCustom(bool needRefresh = true) { _style = UIStyle.Custom; if (needRefresh) Invalidate();