Cursor cannot load all supported file formats
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 1d 13m
- Merged PRs (30d)
- 85
Description
**.NET Core Version:**
all .NET Core and Desktop Framework
**Have you experienced this same bug with .NET Framework?:**
Yes
**Problem description:**
Loading a cursor making use of alpha transparency by filename or stream does not work correctly when done through WinForms and produces a black cursor image (possibly the cursor mask instead of the actual cursor?)

WinForms is [using `IPicture` interop](https://source.dot.net/#System.Windows.Forms/System/Windows/Forms/Cursor.cs,4a07b3923561f20f) to load cursors instead of the win32 cursor API and its unclear if OLE simply doesn't support alpha transparency, or if WinForms is doing something wrong in the interop.
**Expected behavior:**
The rendering should match the builtin hand cursor Windows uses (since in fact its the same file). You can also work around the bug by doing manual interop and calling [LoadCursorFromFile](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadcursorfromfilew). For streams this requires saving the stream to a file first, though.

**Minimal repro:**
Add a button and set the cursor to a file containing alpha transparency, for example the hand cursor distributed with Windows.
`button1.Cursor = new Cursor(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Cursors\\aero_link.cur"));`
Contributor guide
Assessment
This issue has not been assessed yet.