diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 1d9442d3..6af16ce6 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net45/SunnyUI.dll b/Bin/net45/SunnyUI.dll index 7e1499ae..0498cd6c 100644 Binary files a/Bin/net45/SunnyUI.dll and b/Bin/net45/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index 11ad7236..1793e4c7 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index 75caa640..3e466917 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UIComboBox.cs b/SunnyUI/Controls/UIComboBox.cs index 5faac9f4..9bb9f2d4 100644 --- a/SunnyUI/Controls/UIComboBox.cs +++ b/SunnyUI/Controls/UIComboBox.cs @@ -42,11 +42,21 @@ namespace Sunny.UI ListBox.DisplayMemberChanged += Box_DisplayMemberChanged; ListBox.ValueMemberChanged += Box_ValueMemberChanged; ListBox.SelectedValueChanged += ListBox_SelectedValueChanged; + ListBox.ItemsCountChange += ListBox_ItemsCountChange; edit.TextChanged += Edit_TextChanged; DropDownWidth = 150; fullControlSelect = true; } + private void ListBox_ItemsCountChange(object sender, EventArgs e) + { + if (ListBox.Count == 0) + { + Text = ""; + edit.Text = ""; + } + } + public new EventHandler TextChanged; private void Edit_TextChanged(object sender, EventArgs e) @@ -142,7 +152,8 @@ namespace Sunny.UI private void UIComboBox_ButtonClick(object sender, EventArgs e) { - ItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, CalcItemFormHeight())); + if (Items.Count > 0) + ItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, CalcItemFormHeight())); } public override void SetStyleColor(UIBaseStyle uiColor)