diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 2fc99357..267af172 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 65d79c97..c2400a87 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 0c9d3be6..95b15c2c 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll index be428c6b..0c16a566 100644 Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index feab5fc4..77ae6cd0 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index 5e5d6d91..f1b7e7fb 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -61,6 +61,7 @@ namespace Sunny.UI listbox.SelectedIndexChanged += Listbox_SelectedIndexChanged; listbox.SelectedValueChanged += Listbox_SelectedValueChanged; listbox.Click += Listbox_Click; + listbox.MouseClick += Listbox_MouseClick; listbox.DoubleClick += Listbox_DoubleClick; listbox.BeforeDrawItem += Listbox_BeforeDrawItem; listbox.MouseDown += Listbox_MouseDown; @@ -78,11 +79,57 @@ namespace Sunny.UI timer.Start(); } + private void Listbox_MouseClick(object sender, MouseEventArgs e) + { + MouseClick?.Invoke(this, e); + } + + public new event MouseEventHandler MouseClick; public event EventHandler ItemsClear; public event EventHandler ItemsAdd; public event EventHandler ItemsRemove; public event EventHandler ItemsInsert; + public void BeginUpdate() + { + listbox.BeginUpdate(); + } + + public void EndUpdate() + { + listbox.EndUpdate(); + } + + public void ClearSelected() + { + listbox.ClearSelected(); + } + + public int FindString(string s, int startIndex) + { + return listbox.FindString(s, startIndex); + } + + public int FindStringExact(string s, int startIndex) + { + return listbox.FindStringExact(s, startIndex); + } + + public Rectangle GetItemRectangle(int index) + { + return listbox.GetItemRectangle(index); + } + + public bool GetSelected(int index) + { + return listbox.GetSelected(index); + } + + public void SetSelected(int index, bool value) + { + listbox.SetSelected(index, value); + } + private void Listbox_ItemsInsert(object sender, EventArgs e) { ItemsInsert?.Invoke(this, e); @@ -98,7 +145,6 @@ namespace Sunny.UI ItemsAdd?.Invoke(this, e); } - private void Listbox_ItemsClear(object sender, EventArgs e) { ItemsClear?.Invoke(this, e); @@ -150,6 +196,33 @@ namespace Sunny.UI get => listbox.SelectedIndices; } + [DefaultValue(false)] + public bool Sorted + { + get => listbox.Sorted; + set => listbox.Sorted = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int TopIndex + { + get => listbox.TopIndex; + set => listbox.TopIndex = value; + } + + [DefaultValue(true)] + public bool UseTabStops + { + get => listbox.UseTabStops; + set => listbox.UseTabStops = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public SelectedObjectCollection SelectedItems + { + get => listbox.SelectedItems; + } + protected override void OnContextMenuStripChanged(EventArgs e) { base.OnContextMenuStripChanged(e);