* UIListBox:增加一些原有属性

This commit is contained in:
Sunny 2021-02-08 11:43:34 +08:00
parent 8993ccb443
commit ad6182153a
13 changed files with 83 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -11,7 +11,7 @@ namespace Sunny.UI.Demo
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.SetHighDpiMode(HighDpiMode.DpiUnawareGdiScaled);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FMain());

View File

@ -24,7 +24,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SunnyUI" Version="3.0" />
<PackageReference Include="SunnyUI" Version="3.0.1" />
</ItemGroup>
<ItemGroup>

View File

@ -8,20 +8,20 @@
".NETCoreApp,Version=v5.0": {
"SunnyUI.Net5.Demo/3.0.1": {
"dependencies": {
"SunnyUI": "3.0.0"
"SunnyUI": "3.0.1"
},
"runtime": {
"SunnyUI.Net5.Demo.dll": {}
}
},
"SunnyUI/3.0.0": {
"SunnyUI/3.0.1": {
"dependencies": {
"SunnyUI.Common": "3.0.0"
},
"runtime": {
"lib/net5.0-windows7.0/SunnyUI.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.0.0"
"assemblyVersion": "3.0.1.0",
"fileVersion": "3.0.1.0"
}
}
},
@ -41,12 +41,12 @@
"serviceable": false,
"sha512": ""
},
"SunnyUI/3.0.0": {
"SunnyUI/3.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-evxpOlq6cuG+Dv2sYm5Ssc22acA1HwGLRBg8wTPYHqeaKhwtlgPfXG10ZOsNUIHyBK4ZVfawUtm7iDQUEcU0Ew==",
"path": "sunnyui/3.0.0",
"hashPath": "sunnyui.3.0.0.nupkg.sha512"
"sha512": "sha512-M92GbvBBNecHBVGZNnrX/Ual9hLC9bMts3T/PAizPFaFpBGdpgr7jbkRUi3D0VFe/mbBYJDhhY5/gw51tAONiQ==",
"path": "sunnyui/3.0.1",
"hashPath": "sunnyui.3.0.1.nupkg.sha512"
},
"SunnyUI.Common/3.0.0": {
"type": "package",

View File

@ -1,9 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Sunny\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Sunny\\.nuget\\packages",
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
"C:\\Users\\Administrator\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Administrator\\.nuget\\packages"
]
}
}

View File

@ -313,6 +313,77 @@ namespace Sunny.UI
_style = UIStyle.Custom;
}
}
[DefaultValue("")]
[Description("指示要为此控件中的项显示的属性")]
[TypeConverter("System.Windows.Forms.Design.DataMemberFieldConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[Editor("System.Windows.Forms.Design.DataMemberFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
public string DisplayMember
{
get => listbox.DisplayMember;
set => listbox.DisplayMember = value;
}
[DefaultValue("")]
[Description("指示用作控件中项的实际值的属性")]
[Editor("System.Windows.Forms.Design.DataMemberFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
public string ValueMember
{
get => listbox.ValueMember;
set => listbox.ValueMember = value;
}
[DefaultValue(null)]
[RefreshProperties(RefreshProperties.Repaint)]
[AttributeProvider(typeof(IListSource))]
[Description("指示此控件将用来获取其项的列表")]
public object DataSource
{
get => listbox.DataSource;
set => listbox.DataSource = value;
}
private void Box_ValueMemberChanged(object sender, EventArgs e)
{
ValueMemberChanged?.Invoke(sender, e);
}
private void Box_DisplayMemberChanged(object sender, EventArgs e)
{
DisplayMemberChanged?.Invoke(sender, e);
}
private void Box_DataSourceChanged(object sender, EventArgs e)
{
DataSourceChanged?.Invoke(sender, e);
}
public event EventHandler DataSourceChanged;
public event EventHandler DisplayMemberChanged;
public event EventHandler ValueMemberChanged;
[DefaultValue(null)]
[Description("格式说明符,指示显示值的方式")]
public string FormatString
{
get => listbox.FormatString;
set => listbox.FormatString = value;
}
[Description("获取或设置指示显示值是否可以进行格式化操作。"), Category("SunnyUI")]
[DefaultValue(false)]
public bool FormattingEnabled
{
get => listbox.FormattingEnabled;
set => listbox.FormattingEnabled = value;
}
public string GetItemText(object item)
{
return listbox.GetItemText(item);
}
}
/// <summary>