* UIBreadcrumb, UICheckBoxGroup, UIRadioButtonGroup: 更改列表项为UIObjectCollection

This commit is contained in:
Sunny 2021-05-19 23:17:09 +08:00
parent 2c3d294a3d
commit 2fcb9d1f9e
9 changed files with 6 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -37,6 +37,7 @@ namespace Sunny.UI
{
public UIBreadcrumb()
{
items.CountChange += Items_CountChange;
SetStyleFlags(true, false);
ShowText = false;
ShowRect = false;
@ -48,23 +49,23 @@ namespace Sunny.UI
foreColor = Color.White;
}
~UIBreadcrumb()
private void Items_CountChange(object sender, EventArgs e)
{
listbox.Dispose();
Invalidate();
}
public delegate void OnValueChanged(object sender, int value);
public event OnValueChanged ItemIndexChanged;
private readonly ListBox listbox = new ListBox();
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Localizable(true)]
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
[MergableProperty(false)]
[Description("列表项"), Category("SunnyUI")]
public ListBox.ObjectCollection Items => listbox.Items;
public UIObjectCollection Items => items;
private readonly UIObjectCollection items = new UIObjectCollection();
private readonly ConcurrentDictionary<int, Point[]> ClickArea = new ConcurrentDictionary<int, Point[]>();

View File

@ -97,11 +97,6 @@ namespace Sunny.UI
private readonly UIObjectCollection items = new UIObjectCollection();
private void Listbox_OnItemsCountChange(object sender, EventArgs e)
{
Invalidate();
}
private void CreateBoxes()
{
if (Items.Count != boxes.Count)