diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 00742811..2bd43d8d 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 2159528a..c334cc93 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe index 678729a8..8b59a504 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index 00742811..2bd43d8d 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FTransfer.Designer.cs b/SunnyUI.Demo/Controls/FTransfer.Designer.cs index a7814f68..475b3ac6 100644 --- a/SunnyUI.Demo/Controls/FTransfer.Designer.cs +++ b/SunnyUI.Demo/Controls/FTransfer.Designer.cs @@ -37,6 +37,7 @@ // this.PagePanel.Controls.Add(this.uiLine1); this.PagePanel.Controls.Add(this.uiTransfer1); + this.PagePanel.Size = new System.Drawing.Size(800, 480); // // uiTransfer1 // @@ -68,6 +69,8 @@ this.uiTransfer1.Size = new System.Drawing.Size(427, 370); this.uiTransfer1.TabIndex = 3; this.uiTransfer1.Text = "uiTransfer1"; + this.uiTransfer1.ItemsLeftCountChange += new System.EventHandler(this.uiTransfer1_ItemsLeftCountChange); + this.uiTransfer1.ItemsRightCountChange += new System.EventHandler(this.uiTransfer1_ItemsRightCountChange); // // uiLine1 // @@ -84,7 +87,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(800, 515); this.Name = "FTransfer"; this.Symbol = 61516; this.Text = "Transfer"; diff --git a/SunnyUI.Demo/Controls/FTransfer.cs b/SunnyUI.Demo/Controls/FTransfer.cs index 5bf5e86a..20e3a906 100644 --- a/SunnyUI.Demo/Controls/FTransfer.cs +++ b/SunnyUI.Demo/Controls/FTransfer.cs @@ -1,4 +1,6 @@ -namespace Sunny.UI.Demo +using System; + +namespace Sunny.UI.Demo { public partial class FTransfer : UITitlePage { @@ -6,5 +8,15 @@ { InitializeComponent(); } + + private void uiTransfer1_ItemsLeftCountChange(object sender, System.EventArgs e) + { + Console.WriteLine("Left: " + uiTransfer1.ItemsLeft.Count); + } + + private void uiTransfer1_ItemsRightCountChange(object sender, System.EventArgs e) + { + Console.WriteLine("Right: " + uiTransfer1.ItemsRight.Count); + } } } diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index 291be117..49fd3203 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -37,6 +37,7 @@ namespace Sunny.UI { private readonly ListBoxEx listbox = new ListBoxEx(); private readonly UIScrollBar bar = new UIScrollBar(); + private readonly Timer timer = new Timer(); public UIListBox() { @@ -61,6 +62,25 @@ namespace Sunny.UI listbox.Click += Listbox_Click; listbox.DoubleClick += Listbox_DoubleClick; listbox.BeforeDrawItem += Listbox_BeforeDrawItem; + + timer.Tick += Timer_Tick; + timer.Start(); + } + + ~UIListBox() + { + timer.Stop(); + } + + private void Timer_Tick(object sender, EventArgs e) + { + if (Items.Count == 0 && LastCount != 0) + { + LastCount = 0; + timer.Stop(); + ItemsCountChange?.Invoke(sender, e); + timer.Start(); + } } protected override void OnFontChanged(EventArgs e) diff --git a/SunnyUI/Controls/UITransfer.cs b/SunnyUI/Controls/UITransfer.cs index d04ecf83..488faa24 100644 --- a/SunnyUI/Controls/UITransfer.cs +++ b/SunnyUI/Controls/UITransfer.cs @@ -39,8 +39,23 @@ namespace Sunny.UI { InitializeComponent(); ShowText = false; + + l1.ItemsCountChange += L1_ItemsCountChange; + l2.ItemsCountChange += L2_ItemsCountChange; } + private void L2_ItemsCountChange(object sender, EventArgs e) + { + ItemsRightCountChange?.Invoke(sender, e); + } + + private void L1_ItemsCountChange(object sender, EventArgs e) + { + ItemsLeftCountChange?.Invoke(sender, e); + } + + public event EventHandler ItemsLeftCountChange; + public event EventHandler ItemsRightCountChange; /// /// 左侧列表 ///