UITransfer:增加左右列表项个数变化事件
This commit is contained in:
parent
1002b92cb0
commit
9c469275a3
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
5
SunnyUI.Demo/Controls/FTransfer.Designer.cs
generated
5
SunnyUI.Demo/Controls/FTransfer.Designer.cs
generated
@ -37,6 +37,7 @@
|
|||||||
//
|
//
|
||||||
this.PagePanel.Controls.Add(this.uiLine1);
|
this.PagePanel.Controls.Add(this.uiLine1);
|
||||||
this.PagePanel.Controls.Add(this.uiTransfer1);
|
this.PagePanel.Controls.Add(this.uiTransfer1);
|
||||||
|
this.PagePanel.Size = new System.Drawing.Size(800, 480);
|
||||||
//
|
//
|
||||||
// uiTransfer1
|
// uiTransfer1
|
||||||
//
|
//
|
||||||
@ -68,6 +69,8 @@
|
|||||||
this.uiTransfer1.Size = new System.Drawing.Size(427, 370);
|
this.uiTransfer1.Size = new System.Drawing.Size(427, 370);
|
||||||
this.uiTransfer1.TabIndex = 3;
|
this.uiTransfer1.TabIndex = 3;
|
||||||
this.uiTransfer1.Text = "uiTransfer1";
|
this.uiTransfer1.Text = "uiTransfer1";
|
||||||
|
this.uiTransfer1.ItemsLeftCountChange += new System.EventHandler(this.uiTransfer1_ItemsLeftCountChange);
|
||||||
|
this.uiTransfer1.ItemsRightCountChange += new System.EventHandler(this.uiTransfer1_ItemsRightCountChange);
|
||||||
//
|
//
|
||||||
// uiLine1
|
// uiLine1
|
||||||
//
|
//
|
||||||
@ -84,7 +87,7 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
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.Name = "FTransfer";
|
||||||
this.Symbol = 61516;
|
this.Symbol = 61516;
|
||||||
this.Text = "Transfer";
|
this.Text = "Transfer";
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace Sunny.UI.Demo
|
using System;
|
||||||
|
|
||||||
|
namespace Sunny.UI.Demo
|
||||||
{
|
{
|
||||||
public partial class FTransfer : UITitlePage
|
public partial class FTransfer : UITitlePage
|
||||||
{
|
{
|
||||||
@ -6,5 +8,15 @@
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
private readonly ListBoxEx listbox = new ListBoxEx();
|
private readonly ListBoxEx listbox = new ListBoxEx();
|
||||||
private readonly UIScrollBar bar = new UIScrollBar();
|
private readonly UIScrollBar bar = new UIScrollBar();
|
||||||
|
private readonly Timer timer = new Timer();
|
||||||
|
|
||||||
public UIListBox()
|
public UIListBox()
|
||||||
{
|
{
|
||||||
@ -61,6 +62,25 @@ namespace Sunny.UI
|
|||||||
listbox.Click += Listbox_Click;
|
listbox.Click += Listbox_Click;
|
||||||
listbox.DoubleClick += Listbox_DoubleClick;
|
listbox.DoubleClick += Listbox_DoubleClick;
|
||||||
listbox.BeforeDrawItem += Listbox_BeforeDrawItem;
|
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)
|
protected override void OnFontChanged(EventArgs e)
|
||||||
|
@ -39,8 +39,23 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ShowText = false;
|
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;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 左侧列表
|
/// 左侧列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user