* UITransfer: 增加了显示多个移动的属性

This commit is contained in:
Sunny 2021-08-08 14:47:00 +08:00
parent 76e13855df
commit 299fef8ce3
11 changed files with 39 additions and 29 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -28,10 +28,10 @@
Text = "Button" + index++.ToString("D2")
};
//可以用原生方法Controls.Add
uiFlowLayoutPanel1.Controls.Add(btn);
//或者封装的方法Add
//uiFlowLayoutPanel1.Add(btn);
//建议用封装的方法Add
uiFlowLayoutPanel1.Add(btn);
//也可以用原生方法Controls.Add不推荐
//uiFlowLayoutPanel1.Controls.Add(btn);
uiButton3.Enabled = true;
}

View File

@ -24,7 +24,6 @@ using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Windows.Forms.Layout;
namespace Sunny.UI
{
@ -65,11 +64,6 @@ namespace Sunny.UI
timer.Stop();
}
public override LayoutEngine LayoutEngine
{
get { return Panel.LayoutEngine; }
}
[DefaultValue(System.Windows.Forms.FlowDirection.LeftToRight)]
[Localizable(true)]
public FlowDirection FlowDirection

View File

@ -362,20 +362,20 @@ namespace Sunny.UI
}
}
protected override void WndProc(ref Message m)
{
if (IsDisposed || Disposing) return;
if (IsHandleCreated)
{
if (m.Msg == Win32.User.WM_ERASEBKGND)
{
m.Result = IntPtr.Zero;
return;
}
}
base.WndProc(ref m);
}
//protected override void WndProc(ref Message m)
//{
// if (IsDisposed || Disposing) return;
// if (IsHandleCreated)
// {
// if (m.Msg == Win32.User.WM_ERASEBKGND)
// {
// m.Result = IntPtr.Zero;
// return;
// }
// }
//
// base.WndProc(ref m);
//}
public ImageListBox()
{

View File

@ -607,11 +607,11 @@ namespace Sunny.UI
ItemsInsert?.Invoke(this, EventArgs.Empty);
}
if (m.Msg == Win32.User.WM_ERASEBKGND)
{
m.Result = IntPtr.Zero;
return;
}
//if (m.Msg == Win32.User.WM_ERASEBKGND)
//{
// m.Result = IntPtr.Zero;
// return;
//}
}
base.WndProc(ref m);

View File

@ -46,6 +46,14 @@ namespace Sunny.UI
l2.ItemsCountChange += L2_ItemsCountChange;
}
[DefaultValue(true)]
[Description("显示多选按钮"), Category("SunnyUI")]
public bool ShowMulti
{
get => b1.Visible;
set => b1.Visible = b4.Visible = value;
}
private void L2_ItemsCountChange(object sender, EventArgs e)
{
ItemsRightCountChange?.Invoke(this, e);
@ -84,12 +92,17 @@ namespace Sunny.UI
[Browsable(false)]
public ListBox ListBoxRight => l2.ListBox;
public delegate void ItemChange(object sender, object item);
public event ItemChange ItemAdd;
public event ItemChange ItemRemove;
private void b1_Click(object sender, EventArgs e)
{
foreach (object item in l1.Items)
{
l2.Items.Add(item);
ItemAdd?.Invoke(this, item);
}
l1.Items.Clear();
@ -106,6 +119,7 @@ namespace Sunny.UI
int idx = l1.SelectedIndex;
object item = l1.SelectedItem;
l2.Items.Add(item);
ItemAdd?.Invoke(this, item);
l1.Items.Remove(item);
if (l2.Items.Count > 0)
@ -132,6 +146,7 @@ namespace Sunny.UI
int idx = l2.SelectedIndex;
object item = l2.SelectedItem;
l1.Items.Add(item);
ItemRemove?.Invoke(this, item);
l2.Items.Remove(item);
if (l1.Items.Count > 0)
@ -156,6 +171,7 @@ namespace Sunny.UI
foreach (object item in l2.Items)
{
l1.Items.Add(item);
ItemRemove?.Invoke(this, item);
}
l2.Items.Clear();