diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index fb4bdc9d..b2acbd39 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 5e470abe..a5a701ef 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index 8158512f..c67fb8a4 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll index b82a14fe..9af2d1ef 100644 Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index 3b3ae136..740809c0 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 7d5e6b69..ff915d0c 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; +using System.IO; using System.Windows.Forms; namespace Sunny.UI @@ -1005,7 +1006,10 @@ namespace Sunny.UI if (ShowTitleIcon && Icon != null) { - e.Graphics.DrawImage(Icon.ToBitmap(), 6, (TitleHeight - 24) / 2, 24, 24); + using (Image image = IconToImage(Icon)) + { + e.Graphics.DrawImage(image, 6, (TitleHeight - 24) / 2, 24, 24); + } } SizeF sf = e.Graphics.MeasureString(Text, Font); @@ -1019,6 +1023,14 @@ namespace Sunny.UI } } + private Image IconToImage(Icon icon) + { + MemoryStream mStream = new MemoryStream(); + icon.Save(mStream); + Image image = Image.FromStream(mStream); + return image; + } + private bool showTitleIcon; [Description("显示标题栏图标"), Category("SunnyUI")]