using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace opacity { public partial class Form1 : Form { [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SetLayeredWindowAttributes")] private static extern int SetLayeredWindowAttributes(IntPtr hwnd, int crKey, int bAlpha, int dwFlags); public Form1() { InitializeComponent(); this.BackColor = Color.FromArgb(255, 255, 255);
this.Opacity = 0.5;
SetLayeredWindowAttributes(Handle, 0xffffff, 0, 1); } } }