Projektdateien hinzufügen.
This commit is contained in:
33
VideoBrowser/Helpers/ImageHelper.cs
Normal file
33
VideoBrowser/Helpers/ImageHelper.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user