Is it possible (and how) to adjust the blending mode used to display a WPF form on the desktop?
I have a window that serves as an overlay for the entire screen. Here's the XAML:
<Window x:Class="RedGreenBarsWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Red/Green Overlay" Topmost="True" Height="300" Width="525" AllowsTransparency="True" WindowStyle="None" Background="Transparent" WindowStartupLocation="Manual" IsHitTestVisible="False">
<Canvas Name="canvas" />
</Window>
It can't be clicked, and it gets resized and moved to cover the entire screen when the Window loads. I then draw some shapes on the canvas like this:
System.Windows.Media.Brush red = new SolidColorBrush(System.Windows.Media.Color.FromArgb(200, 255, 0, 0));
System.Windows.Size s = new System.Windows.Size(System.Windows.SystemParameters.PrimaryScreenWidth, System.Windows.SystemParameters.PrimaryScreenHeight);
int lines = 20;
for (double i = 0; i < s.Width; i += s.Width / lines)
{
System.Windows.Shapes.Rectangle rect = new System.Windows.Shapes.Rectangle
{
Width = s.Width / lines,
Height = s.Height
};
rect.Fill = red;
Canvas.SetTop(rect, 0);
Canvas.SetLeft(rect, i * 2);
canvas.Children.Add(rect);
}
This does exactly what it should, but not what I want. Here's a visualization done in Photoshop (mine looks like "Normal"):
I need to figure out a way to make it look like the red box on the right, where the text isn't lightened by the overlaying colour. I've searched high and low, and although there are libraries out there that can accomplish this with elements within the Window, I need the blend mode to extend over the entire desktop. How can this be done?