Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello, I am having trouble reading pixel colors with GetPixel() user32 api from a .NET program which has a form that is in Transparent mode. It's easy to reproduce this on any program you might want to make.

 

I was wondering if anyone if anyone knows why this might be happening and if there is a way around it. Even though there are plenty of pictures, text, etc on the "transparent" form GetPixel can not read any of the colors from those objects.

 

Oh very important is that BitBlt also does not work on "Transparent" forms. So how can one take screenshots of a program?

 

Thanks

 

  Public Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As IntPtr, ByVal x As Integer, ByVal y As Integer) As Integer
   

 

  Public Declare Function BitBlt Lib "gdi32.dll" (ByVal hdc As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As TernaryRasterOperations) As Boolean

   Public Enum TernaryRasterOperations
       SRCCOPY = &HCC0020 ' dest = source
       SRCPAINT = &HEE0086 ' dest = source OR dest
       SRCAND = &H8800C6 ' dest = source AND dest
       SRCINVERT = &H660046 ' dest = source XOR dest
       SRCERASE = &H440328 ' dest = source AND (NOT dest )
       NOTSRCCOPY = &H330008 ' dest = (NOT source)
       NOTSRCERASE = &H1100A6 ' dest = (NOT src) AND (NOT dest)
       MERGECOPY = &HC000CA ' dest = (source AND pattern)
       MERGEPAINT = &HBB0226 ' dest = (NOT source) OR dest
       PATCOPY = &HF00021 ' dest = pattern
       PATPAINT = &HFB0A09 ' dest = DPSnoo
       PATINVERT = &H5A0049 ' dest = pattern XOR dest
       DSTINVERT = &H550009 ' dest = (NOT dest)
       BLACKNESS = &H42 ' dest = BLACK
       WHITENESS = &HFF0062 ' dest = WHITE
   End Enum

Currently Using: Visual Basic.Net 2005, .Net Framework 2.0

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...