c# - WPF Send click through control -
i want send mouse click application behind control. have topmost transparent window , controls in it. able send click through of controls.
i have tried setting property ishittestvisible="false" control, doesn´t work. doesn´t send click through control desktop example.
i´ve tried solution proposed in question: how create semi transparent window in wpf allows mouse events pass through
and works, make transparent controls, not window.
how apply solution question single control, example ellipse?
the solution:
public static class windowsservices { const int ws_ex_transparent = 0x00000020; const int gwl_exstyle = (-20); [dllimport("user32.dll")] static extern int getwindowlong(intptr hwnd, int index); [dllimport("user32.dll")] static extern int setwindowlong(intptr hwnd, int index, int newstyle); public static void setwindowextransparent(intptr hwnd) { var extendedstyle = getwindowlong(hwnd, gwl_exstyle); setwindowlong(hwnd, gwl_exstyle, extendedstyle | ws_ex_transparent); } } protected override void onsourceinitialized(eventargs e) { base.onsourceinitialized(e); var hwnd = new windowinterophelper(this).handle; windowsservices.setwindowextransparent(hwnd); }
Comments
Post a Comment