private void lockdownWindow(IntPtr p) { GetWindowRect(p, out info); int w = info.Right - info.Left; int h = info.Bottom - info.Top; LockdownForm lockdown = new LockdownForm(); BackgroundForm background = new BackgroundForm(lockdown); background.Size = new Size(w, h); SetWindowLong(background.Handle, GWL_EXSTYLE, GetWindowLong(background.Handle, GWL_EXSTYLE) | WS_EX_LAYERED); SetParent(background.Handle, p); background.SetBounds(0, 0, 0, 0, BoundsSpecified.Location); background.Show(); SetLayeredWindowAttributes(background.Handle, 0, 200, LWA_ALPHA); lockdown.Width = w; SetWindowLong(lockdown.Handle, GWL_EXSTYLE, GetWindowLong(lockdown.Handle, GWL_EXSTYLE) | WS_EX_LAYERED); SetParent(lockdown.Handle, p); lockdown.SetBounds(0, (h - lockdown.Height) / 2, 0, 0, BoundsSpecified.Location); lockdown.Show(); SetLayeredWindowAttributes(lockdown.Handle, 0, 255, LWA_ALPHA); }
public BackgroundForm(LockdownForm lockdown) { InitializeComponent(); lk = lockdown; }