diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index 117e718b..b9040912 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 b4678996..6afc6b80 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net45/SunnyUI.Common.dll b/Bin/net45/SunnyUI.Common.dll new file mode 100644 index 00000000..a0a7ac8d Binary files /dev/null and b/Bin/net45/SunnyUI.Common.dll differ diff --git a/Bin/net45/SunnyUI.dll b/Bin/net45/SunnyUI.dll new file mode 100644 index 00000000..b17962c2 Binary files /dev/null and b/Bin/net45/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index 58a8e746..e774fef7 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 24571a04..b935fc53 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 4d553b90..49aea1b2 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UIHeaderButton.cs b/SunnyUI/Controls/UIHeaderButton.cs index ef75a2b0..aab51163 100644 --- a/SunnyUI/Controls/UIHeaderButton.cs +++ b/SunnyUI/Controls/UIHeaderButton.cs @@ -354,9 +354,10 @@ namespace Sunny.UI } } } + public TextImageRelation textImageRelation = TextImageRelation.ImageAboveText; - [DefaultValue(typeof(TextImageRelation), "ImageAboveText")] + [DefaultValue(TextImageRelation.ImageAboveText)] [Description("指定图像与文本的相对位置"), Category("SunnyUI")] public TextImageRelation TextImageRelation { @@ -367,6 +368,7 @@ namespace Sunny.UI Invalidate(); } } + protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); @@ -439,15 +441,10 @@ namespace Sunny.UI switch (textImageRelation) { - /*case TextImageRelation.Overlay: - { - - } - break; */ case TextImageRelation.TextAboveImage: - { + { #region 文本在上 - e.Graphics.DrawString(Text, Font, color, (Width - sf.Width) / 2, Padding.Top ); + e.Graphics.DrawString(Text, Font, color, (Width - sf.Width) / 2, Padding.Top); //字体图标 if (Symbol > 0 && Image == null) @@ -458,7 +455,7 @@ namespace Sunny.UI bcColor = CircleHoverColor; } - e.Graphics.FillEllipse(bcColor, (Width - CircleSize) / 2.0f, Height - Padding.Bottom- CircleSize, CircleSize, CircleSize); + e.Graphics.FillEllipse(bcColor, (Width - CircleSize) / 2.0f, Height - Padding.Bottom - CircleSize, CircleSize, CircleSize); e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor, new RectangleF( symbolOffset.X + (Width - CircleSize) / 2.0f, @@ -468,8 +465,8 @@ namespace Sunny.UI } else if (Image != null) { - e.Graphics.DrawImage(Image, (Width - ImageSize.Width) / 2.0f, Height - Padding.Bottom - ImageSize.Height+imageTop, ImageSize.Width, ImageSize.Height); - } + e.Graphics.DrawImage(Image, (Width - ImageSize.Width) / 2.0f, Height - Padding.Bottom - ImageSize.Height + imageTop, ImageSize.Width, ImageSize.Height); + } #endregion } break; @@ -502,8 +499,8 @@ namespace Sunny.UI #endregion } break; - case TextImageRelation.TextBeforeImage : - { + case TextImageRelation.TextBeforeImage: + { #region 文本在前 e.Graphics.DrawString(Text, Font, color, Padding.Left, (Height - sf.Height) / 2); @@ -516,7 +513,7 @@ namespace Sunny.UI bcColor = CircleHoverColor; } - e.Graphics.FillEllipse(bcColor, Width - Padding.Right - CircleSize, (Height - CircleSize) / 2.0f, CircleSize, CircleSize); + e.Graphics.FillEllipse(bcColor, Width - Padding.Right - CircleSize, (Height - CircleSize) / 2.0f, CircleSize, CircleSize); e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor, new RectangleF( symbolOffset.X + Width - Padding.Right - CircleSize, @@ -531,7 +528,7 @@ namespace Sunny.UI #endregion } break; - default : + default: { #region 图片在上 //字体图标 @@ -555,12 +552,12 @@ namespace Sunny.UI { e.Graphics.DrawImage(Image, (Width - ImageSize.Width) / 2.0f, ImageTop, ImageSize.Width, ImageSize.Height); } - + e.Graphics.DrawString(Text, Font, color, (Width - sf.Width) / 2, Height - Padding.Bottom - sf.Height); #endregion } break; - } + } } [DefaultValue(null)] diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index 16b759cf..fa1290a1 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -1,7 +1,7 @@  - net5.0-windows;netcoreapp3.1;net40 + net5.0-windows;netcoreapp3.1;net40;net45 {AB1CB247-E20B-4CBE-B269-570ADDD96C53} true Sunny.UI @@ -66,6 +66,12 @@ + + + + + + True