This repository has been archived on 2026-03-14. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Eco/VideoBrowser/Helpers/ImageHelper.cs
2023-07-24 12:00:34 +02:00

33 lines
888 B
C#

namespace VideoBrowser.Helpers
{
using System.Drawing;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
/// <summary>
/// Defines the <see cref="ImageHelper" />.
/// </summary>
public static class ImageHelper
{
#region Methods
/// <summary>
/// The ToImageSource.
/// </summary>
/// <param name="icon">The icon<see cref="Icon"/>.</param>
/// <returns>The <see cref="ImageSource"/>.</returns>
public static ImageSource ToImageSource(this Icon icon)
{
var imageSource = Imaging.CreateBitmapSourceFromHIcon(
icon.Handle,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
return imageSource;
}
#endregion Methods
}
}