From afaec795196522b8effe5646821fe6d4067576bc Mon Sep 17 00:00:00 2001 From: Sunny Date: Fri, 11 Aug 2023 21:44:01 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIComboBox:=20Items.Clear=E5=90=8E=EF=BC=8C?= =?UTF-8?q?DropDownStyle=E4=B8=BADropDown=E6=97=B6=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E6=B8=85=E7=A9=BAText?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UIComboBox.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/SunnyUI/Controls/UIComboBox.cs b/SunnyUI/Controls/UIComboBox.cs index afeb1941..daa114a1 100644 --- a/SunnyUI/Controls/UIComboBox.cs +++ b/SunnyUI/Controls/UIComboBox.cs @@ -37,6 +37,7 @@ * 2023-03-15: V3.3.3 修改失去焦点自动关闭过滤下拉框 * 2023-06-28: V3.3.9 增加过滤时忽略大小写 * 2023-07-03: V3.3.9 修改了几个对象的释放 + * 2023-08-11: V3.4.1 Items.Clear后,DropDownStyle为DropDown时,不清空Text ******************************************************************************/ using System; @@ -308,7 +309,7 @@ namespace Sunny.UI private void ListBox_ItemsRemove(object sender, EventArgs e) { - if (ListBox.Count == 0) + if (ListBox.Count == 0 && DropDownStyle == UIDropDownStyle.DropDownList) { Text = ""; edit.Text = ""; @@ -317,8 +318,11 @@ namespace Sunny.UI private void ListBox_ItemsClear(object sender, EventArgs e) { - Text = ""; - edit.Text = ""; + if (DropDownStyle == UIDropDownStyle.DropDownList) + { + Text = ""; + edit.Text = ""; + } } public new event EventHandler TextChanged;