I'm working on a program in C# that takes screenshots of a potion of the user's screen. For the most pert it works as it should, but I've recently run into one issue. There seems to be (at least) one pixel color that always appears as transparent in the output image. Any instance of the color #0D0B0C (RGB 13, 11, 12) appears transparent in the saved png. This is with the PixelFormat set to Format32bppArgb. If I set it to Format32bppRgb or Format24bppRgb, that same pixel color appears as black in the saved png.
I have no idea what could be causing this, but the only thing I've been able to do to "fix" it is to clear the graphics object to that color before doing CopyFromScreen(). I'm loathe to do that though for a few reasons. First, I don't know if that's the only color that has the issue (what with 16,777,216 colors there's quite a few possibilities), and second, I hate hack fixes, this seems like a hack fix.
Can anyone shed any light on what might be causing this issue? I've messed with the PixelFormat on the bitmap creation and with the CopyPixelOperation in the CopyFromScreen method, nothing seems to work. The fact that clearing the graphics object to that color "fixes" it seems to tell me that the transparency is coming from the screen data itself, but that doesn't make sense. I've been staring at this for too long, I think I need a fresh perspective on it. If anyone has any idea why this might be happening I'd love to hear it. Thank you.