dotnet / dotnet/dotnet-api-docs
Sometimes fails to get image
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
Depending on how the image was copied to clipboard, the result of this method can result in a blank (but with a finite width and height) image. This is obvious when in WPF and Image control is set image.Source = Clipboard.GetImage()
A solution for this problem exists, but code needs to use Windows.Forms API and the gdi32.dll. Applications such as Free Clipboard Viewer 3.0 display the bitmap correctly.
https://stackoverflow.com/questions/25749843/wpf-image-source-clipboard-getimage-is-not-displayed/25751020#25751020
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 85bb3f94-8ee1-71c6-5f3d-1a79acf36e05
* Version Independent ID: bd9a08d0-e44e-b797-7c8d-2998364402bc
* Content: [Clipboard.GetImage Method (System.Windows)](https://docs.microsoft.com/en-us/dotnet/api/system.windows.clipboard.getimage?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DEN-US%26k%3Dk(System.Windows.Clipboard.GetImage);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.6.1);k(DevLang-VB)%26rd%3Dtrue%26f%3D255%26MSPPError%3D-2147217396&view=netframework-4.7.2)
* Content Source: [xml/System.Windows/Clipboard.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Windows/Clipboard.xml)
* Service: **.net**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**
Contributor guide
Assessment
This issue has not been assessed yet.