'C# Opacity change on application change

How do i change my C# window opacity after user clicks onto another application? my application stays on topmost and i want for it to be translucent so the user can see the full page



Solution 1:[1]

In your Form's contructor:

this.Activated += (sender, e) => this.Opacity = 1.0;
this.Deactivate += (sender, e) => 
{
   if (!this.Disposing)
      this.Opacity = 0.3
};

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1