It’s a little hard to explain what I need but i’ll try:
I need to write application (winform) which will be some kind of filter to image/other forms behind it. With one exception – all behind form should looks as is except of red (for example) color, which have to be replaced to any other specified color, white for example.
So let’s imagine I have opened windows Word with few lines of text. With red and black letters.
So when i place my application above this text – it should “filter” red symbols and fill them to white.
So as i understand this task: i have to snap area behind the form, then process it (replace colors) and after draw this image on my form body.
Any links or keywords for solution?
UPD:
so – this is my final solution:
- do form transparent (using TransparencyKey and BackColor properties)
- place picturebox over the form
- when we need to update image in picturebox – we replace current image with pictureBox1.Image = null;, then refreshing form with (this.Refresh()) and do new snapshot
thanks for all 😉
UPD 2:
sample http://dl.dropbox.com/u/4486681/result.png
UPD 3:
here are sources
you can create a snapshot of the desktop using the following code:
Replace the dimensions and position with the coordinates of your form. This way you get a bitmap of what’s behind your form. Then you can do the color replacement on that bitmap.
Please note that due to settings like ClearType and other anti-aliasing mechanisms, you have to also take into account “intermediate pixels” when doing the color replacement. Otherwise things will look funny 🙂