mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-18 16:41:36 -07:00
19 lines
545 B
C#
19 lines
545 B
C#
using System.Drawing;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Media;
|
|
|
|
namespace Bloxstrap.Extensions
|
|
{
|
|
public static class IconEx
|
|
{
|
|
public static Icon GetSized(this Icon icon, int width, int height) => new(icon, new Size(width, height));
|
|
|
|
public static ImageSource GetImageSource(this Icon icon)
|
|
{
|
|
using MemoryStream stream = new();
|
|
icon.Save(stream);
|
|
return BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
|
}
|
|
}
|
|
}
|