protected void MakeWindowClickbale() { try { var hwnd = new WindowInteropHelper(this).Handle; var style = Win32Interfaces.GetWindowLong(hwnd, Win32Interfaces.GWL_EXSTYLE); Win32Interfaces.SetWindowLong(hwnd, Win32Interfaces.GWL_EXSTYLE, style ^ Win32Interfaces.WS_EX_LAYERED ^ Win32Interfaces.WS_EX_TRANSPARENT); } catch (Exception e) { Logger.WriteLog(Convert.ToString(e)); } }
protected void MakeWindowClickThrought() { try { if (!_IsClickThrought) { this.UIThread(() => { var hwnd = new WindowInteropHelper(this).Handle; var style = Win32Interfaces.GetWindowLong(hwnd, Win32Interfaces.GWL_EXSTYLE); Win32Interfaces.SetWindowLong(hwnd, Win32Interfaces.GWL_EXSTYLE, style | Win32Interfaces.WS_EX_LAYERED | Win32Interfaces.WS_EX_TRANSPARENT); _IsClickThrought = true; }); } } catch (Exception e) { Logger.WriteLog(Convert.ToString(e)); } }