From 05cdc507efebb4da78196e238a7c045487506240 Mon Sep 17 00:00:00 2001 From: Giduac Date: Fri, 15 Nov 2024 14:08:20 +0100 Subject: [PATCH] 1842-V85-Setting-KryptonTextBox-Multiline-to-true-shrinks-the-control Fixes the height problem on enabling MultiLine And the change log --- Documents/Help/Changelog.md | 5 +++++ .../Controls Toolkit/KryptonTextBox.cs | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Documents/Help/Changelog.md b/Documents/Help/Changelog.md index bf54ef8ac..d0c4d5a6a 100644 --- a/Documents/Help/Changelog.md +++ b/Documents/Help/Changelog.md @@ -2,6 +2,11 @@ ======= +# 2025-02-01 - Build 2502 (Patch 5) - Fefruary 2025 +* Resolved [#1842](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1842), `KryptonTextBox` height collapses when MultiLine is enabled. + +======= + # 2024-11-14 - Build 2411 (Patch 4) - November 2024 * Resolved [#1837](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1837), `KryptonMessageBoxDefaultButton.Button2` doesn't work * Resolved [#1820](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1820), When KryptonDataGridView.AutoGenerate is set WinForms columns are used. See the issue for full text. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs index 0a3443b91..d6701879d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs @@ -1854,7 +1854,16 @@ private void AdjustHeight(bool ignoreAnchored) if (!ignoreAnchored || ((Anchor & (AnchorStyles.Bottom | AnchorStyles.Top)) != (AnchorStyles.Bottom | AnchorStyles.Top))) { // If auto sizing the control and not in multiline mode then override the height - Height = _autoSize && !Multiline ? PreferredHeight : _cachedHeight; + // #1842 when autosize == true and MultiLine == true and the _cachedHeight == -1 which is the initial value + // the box collapses. Only when _cachedHeight > -1 it will be assigned. Otherwise Height is left alone. + if (_autoSize && !Multiline) + { + Height = PreferredHeight; + } + else if (_cachedHeight > -1) + { + Height = _cachedHeight; + } } }