mirror of https://github.com/dahall/Vanara.git
Removed dependencies on WinForms and WPF for Gdi32 and User32 assemblies. This forced the removal of extension methods to convert HBITMAP and HICON to System.Windows.Media.Imaging.BitmapSource.
parent
fe9fa528cf
commit
e15ee53a0a
|
@ -114,7 +114,7 @@ namespace Vanara.PInvoke
|
|||
|
||||
//}
|
||||
|
||||
#if !NET20 && !NETSTANDARD2_0 && !NETCOREAPP2_0 && !NETCOREAPP2_1
|
||||
#if WPF && !NET20 && !NETSTANDARD2_0 && !NETCOREAPP2_0 && !NETCOREAPP2_1
|
||||
/// <summary>Creates a <see cref="System.Windows.Media.Imaging.BitmapSource"/> from an <see cref="HBITMAP"/> preserving transparency, if possible.</summary>
|
||||
/// <param name="hbmp">The HBITMAP value.</param>
|
||||
/// <returns>The BitmapSource instance. If <paramref name="hbmp"/> is a <c>NULL</c> handle, <see langword="null"/> is returned.</returns>
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
<PropertyGroup>
|
||||
<Description>PInvoke API (methods, structures and constants) imported from Windows Gdi32.dll</Description>
|
||||
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
|
||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<!--<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWPF>true</UseWPF>-->
|
||||
<TargetFrameworks>net20;net35;net40;net45;net5.0;net6.0;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
|
||||
<AssemblyName>Vanara.PInvoke.Gdi32</AssemblyName>
|
||||
<PackageId>$(AssemblyName)</PackageId>
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<Description>PInvoke API (methods, structures and constants) imported from Windows User32.dll.</Description>
|
||||
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
|
||||
<TargetFrameworks>net20;net35;net40;net45;net5.0;net6.0;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
|
||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<!--<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWPF>true</UseWPF>-->
|
||||
<AssemblyName>Vanara.PInvoke.User32</AssemblyName>
|
||||
<PackageId>$(AssemblyName)</PackageId>
|
||||
<PackageTags>pinvoke;vanara;net-extensions;interop</PackageTags>
|
||||
|
|
|
@ -1242,7 +1242,7 @@ namespace Vanara.PInvoke
|
|||
/// <returns>A managed bitmap instance.</returns>
|
||||
public static Bitmap ToBitmap(this HICON hIcon) => hIcon.IsNull ? null : (Bitmap)Bitmap.FromHicon((IntPtr)hIcon).Clone();
|
||||
|
||||
#if !NET20 && !NETSTANDARD2_0 && !NETCOREAPP2_0 && !NETCOREAPP2_1
|
||||
#if WPF && !NET20 && !NETSTANDARD2_0 && !NETCOREAPP2_0 && !NETCOREAPP2_1
|
||||
/// <summary>Creates a <see cref="System.Windows.Media.Imaging.BitmapSource"/> from an <see cref="HICON"/>.</summary>
|
||||
/// <param name="hIcon">The HICON value.</param>
|
||||
/// <returns>The BitmapSource instance. If <paramref name="hIcon"/> is a <c>NULL</c> handle, <see langword="null"/> is returned.</returns>
|
||||
|
@ -1381,7 +1381,7 @@ namespace Vanara.PInvoke
|
|||
/// <returns>A managed bitmap instance.</returns>
|
||||
public Bitmap ToBitmap() => ((HICON)this).ToBitmap();
|
||||
|
||||
#if !NET20 && !NETSTANDARD2_0 && !NETCOREAPP2_0 && !NETCOREAPP2_1
|
||||
#if WPF && !NET20 && !NETSTANDARD2_0 && !NETCOREAPP2_0 && !NETCOREAPP2_1
|
||||
/// <summary>Creates a <see cref="System.Windows.Media.Imaging.BitmapSource"/> from an <see cref="SafeHICON"/>.</summary>
|
||||
/// <returns>The BitmapSource instance. If this is a <c>NULL</c> handle, <see langword="null"/> is returned.</returns>
|
||||
public System.Windows.Media.Imaging.BitmapSource ToBitmapSource() => ((HICON)this).ToBitmapSource();
|
||||
|
|
Loading…
Reference in New Issue