I use SetWindowLong
to make my Form click through for an overlay. I want to create Buttons and some Elements which are clickable but the Form should be still invisible because it's an overlay.
My OnLoad Function:
this.BackColor = Color.Wheat;
this.TransparencyKey = Color.Wheat;
this.TopMost = true;
//this.DoubleBuffered = true;
this.FormBorderStyle = FormBorderStyle.None;
int initialStyle = GetWindowLong(this.Handle, -20);
SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);
GetWindowRect(handle, out rect);
this.Size = new Size(rect.right - rect.left, rect.bottom - rect.top);
this.Top = rect.top;
this.Left = rect.left;
Some other sections:
public struct RECT
{
public int left, top, right, bottom;
}
And
RECT rect;
public const string WINDOW_NAME = "WINDOWNAME_WHATEVER";
IntPtr handle = FindWindow(null, WINDOW_NAME);
What exact happening to my Buttons and how can I get this working?