getting the visible pixel-colors
-
hi, i'm developing a program with a transparent area. i want to draw a text on that area. how do i get to know the colors of the pixels underneath? i want to adjust the textcolor, so that the text is almost always easy to read (you know, white on black, black on white, etc...) would be the same, if i would like to develop a screenshot-program. any idea? thx. :-O :wq
-
hi, i'm developing a program with a transparent area. i want to draw a text on that area. how do i get to know the colors of the pixels underneath? i want to adjust the textcolor, so that the text is almost always easy to read (you know, white on black, black on white, etc...) would be the same, if i would like to develop a screenshot-program. any idea? thx. :-O :wq
I think you'll have to use P/Invoke to call directly into the Win32 API to do this. Here's a class I wrote that should get you started; it does screenshots now. http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=win32window One more thought - GDI+ supports alpha channel blending, which lets you do transparency. I don't know if it works for windows over the desktop, but it's worth exploring. You'll find it in the System.Drawing namespace.
-
I think you'll have to use P/Invoke to call directly into the Win32 API to do this. Here's a class I wrote that should get you started; it does screenshots now. http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=win32window One more thought - GDI+ supports alpha channel blending, which lets you do transparency. I don't know if it works for windows over the desktop, but it's worth exploring. You'll find it in the System.Drawing namespace.
i will look at your class in a minute. thx. :) i know about the alpha-blending and i'm using it. that's why i need the background-pixels. i want to know which color to use for text in the transparent area. when the background is dark, i use a light color, when it is red i use ... you see? :wq
-
i will look at your class in a minute. thx. :) i know about the alpha-blending and i'm using it. that's why i need the background-pixels. i want to know which color to use for text in the transparent area. when the background is dark, i use a light color, when it is red i use ... you see? :wq
-
yep. it works. great man! :) so GetDesktopWindow is the magic function. hmm. i always thought it takes a picture of the background-image of the desktop...but luckily i was wrong and it really takes a screenshot :) btw: what das msft mean? :eek: :wq
Rüpel wrote: what does msft mean? M_icro_s_o_ft, if I remember correctly Eric is one of the higher ups of the C# team. James "And we are all men; apart from the females." - Colin Davies