How to paste a transparent image from the clipboard in a C# winforms app?

后端 未结 2 845

Note: This question is about pasting from the clipboard, not copying to the clipboard. There are several posts about copying to the clipboard, but couldn\'t find one that ad

2条回答
  •  庸人自扰
    2021-01-12 09:41

    (I can't comment answers)

    Answer of Hans Passant is good, but not correct.

    Screenshot saved with this code.

    You need to replace var ptr = new IntPtr((long)gch.AddrOfPinnedObject() + 40); with var ptr = new IntPtr((long)gch.AddrOfPinnedObject() + 52);

    Screenshot saved with correct code.

    Also you need flip image vertically

提交回复
热议问题