* UIListBox:增加多选行

This commit is contained in:
Sunny 2021-07-29 16:59:56 +08:00
parent 52365fe599
commit 0a08a04b35
14 changed files with 95 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,59 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v5.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v5.0": {
"SunnyUI.Net5.Demo/3.0.5": {
"dependencies": {
"SunnyUI": "3.0.5"
},
"runtime": {
"SunnyUI.Net5.Demo.dll": {}
}
},
"SunnyUI/3.0.5": {
"dependencies": {
"SunnyUI.Common": "3.0.5"
},
"runtime": {
"lib/net5.0-windows7.0/SunnyUI.dll": {
"assemblyVersion": "3.0.5.0",
"fileVersion": "3.0.5.0"
}
}
},
"SunnyUI.Common/3.0.5": {
"runtime": {
"lib/net5.0/SunnyUI.Common.dll": {
"assemblyVersion": "3.0.5.0",
"fileVersion": "3.0.5.0"
}
}
}
}
},
"libraries": {
"SunnyUI.Net5.Demo/3.0.5": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"SunnyUI/3.0.5": {
"type": "package",
"serviceable": true,
"sha512": "sha512-0+U39GWGWBQFmoZom+UOzuST9FxsbUol5RWZgnBLzfGDlR+O4C72HjQ38u9G/SppWBswr5+dmGvFYHBA2HS4uQ==",
"path": "sunnyui/3.0.5",
"hashPath": "sunnyui.3.0.5.nupkg.sha512"
},
"SunnyUI.Common/3.0.5": {
"type": "package",
"serviceable": true,
"sha512": "sha512-bP9fQW8P4fJAV6FfU2Xfw3MtOduLoj/j+MRfdIn3eq9bGqDepg/w5/xqXi393Vuxvxk24eY9+5YMRVyeS+tiRg==",
"path": "sunnyui.common/3.0.5",
"hashPath": "sunnyui.common.3.0.5.nupkg.sha512"
}
}
}

View File

@ -0,0 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Administrator\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Administrator\\.nuget\\packages"
]
}
}

View File

@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net5.0",
"framework": {
"name": "Microsoft.WindowsDesktop.App",
"version": "5.0.0"
}
}
}

Binary file not shown.

View File

@ -27,6 +27,7 @@ using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Design; using System.Drawing.Design;
using System.Windows.Forms; using System.Windows.Forms;
using static System.Windows.Forms.ListBox;
namespace Sunny.UI namespace Sunny.UI
{ {
@ -84,6 +85,22 @@ namespace Sunny.UI
set => listbox.TextAlignment = value; set => listbox.TextAlignment = value;
} }
[DefaultValue(SelectionMode.One)]
[Description("选择项所用方法"), Category("SunnyUI")]
public SelectionMode SelectionMode
{
get => listbox.SelectionMode;
set => listbox.SelectionMode = value;
}
[DefaultValue(SelectionMode.One)]
[Description("选择项所用方法"), Category("SunnyUI")]
public SelectedIndexCollection SelectedIndices
{
get => listbox.SelectedIndices;
}
protected override void OnContextMenuStripChanged(EventArgs e) protected override void OnContextMenuStripChanged(EventArgs e)
{ {
base.OnContextMenuStripChanged(e); base.OnContextMenuStripChanged(e);
@ -737,12 +754,14 @@ namespace Sunny.UI
protected override void OnMouseMove(MouseEventArgs e) protected override void OnMouseMove(MouseEventArgs e)
{ {
base.OnMouseMove(e); base.OnMouseMove(e);
if (SelectionMode != SelectionMode.One) return;
MouseIndex = IndexFromPoint(e.Location); MouseIndex = IndexFromPoint(e.Location);
} }
protected override void OnMouseLeave(EventArgs e) protected override void OnMouseLeave(EventArgs e)
{ {
base.OnMouseLeave(e); base.OnMouseLeave(e);
if (SelectionMode != SelectionMode.One) return;
MouseIndex = -1; MouseIndex = -1;
} }
} }