* UIForm:修改一处Icon图片显示的问题
This commit is contained in:
parent
359513a5d5
commit
ec54bfd398
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user