Question"Click through" Form

Posts 17 of 7 · Page 1 of 1
"Click through" Form
Hi!

So i'm working on a project that displays info on top of a window(this example a game called "Don't Starve".

I got the overlay working as i want, its always ontop of the game, and moves with it when you drag the window around

, Only problem is...

It blocks part of the game (Means you cant click on the game itself cuz the "Invisible" Form is on top, When i make the form smaller so that it is not over the part you want to click is, then it works fine, but i need the form to be able to be larger..

So i'm looking for a way to make the Form Truly transparent (See/Click though) so you can click the game, even when the "Overlay" Is On top of the game.

Many thanks!

This is the code i have so far:
You can find it on google.
Quote Originally Posted by -3ncrypted View Post
You can find it on google.
Someone helped me already, thanks i guess?
Sorry for late reply, but I think you can find that on Google
Quote Originally Posted by willy14 View Post
Sorry for late reply, but I think you can find that on Google
Ye:
Quote Originally Posted by SammyDoge1 View Post

Someone helped me already
Thanks tho.
You can find that on google....
use DwmExtendFrameToClientArea() function:

Code:
[DllImport("Dwmapi.dll")]
static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);

targetHwnd = FindWindow(null, windowName);
RECT rect = new RECT { };

GetWindowRect(targetHwnd, out rect);

int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
MARGINS margins;
margins.left = 0;
margins.right = 0;
margins.top = width;
margins.bottom = height;
this.FormBorderStyle = FormBorderStyle.None;
this.TransparencyKey = Color.Black;
this.BackColor = Color.Black;
this.TopMost = true;
margins.top = width;
margins.bottom = height;
DwmExtendFrameIntoClientArea(this.Handle, ref margins);
Posts 17 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?