void _tmrMainTick_Tick(object sender, EventArgs e) { Invalidate(); if (HotkeysPressed(_pSettings.Key)) { SetWindowStyle = PredefinedTypes.CustomWindowStyles.Clickable; //FormBorderStyle = FormBorderStyle.SizableToolWindow; _iTimer = 2; _dtStart = DateTime.Now; } else if (_iTimer <= 0) { SetWindowStyle = PredefinedTypes.CustomWindowStyles.NotClickable; //FormBorderStyle = FormBorderStyle.None; } ChangeWindowStyle(); if ((DateTime.Now - _dtStart).Seconds >= 1) { _dtStart = DateTime.Now; _iTimer -= 1; } Text = _iTimer.ToString(); }
public static void ChangeWindowStyle(IntPtr handle, PredefinedTypes.CustomWindowStyles wndStyle) { if (wndStyle.Equals(PredefinedTypes.CustomWindowStyles.Clickable)) { var initial = GetWindowLong(handle, (Int32)Gwl.ExStyle); SetWindowLong(handle, (Int32)Gwl.ExStyle, (IntPtr)(initial & ~(Int32)Ws.ExTransparent)); } else if (wndStyle.Equals(PredefinedTypes.CustomWindowStyles.NotClickable)) { var initial = GetWindowLong(handle, (Int32)Gwl.ExStyle); SetWindowLong(handle, (Int32)Gwl.ExStyle, (IntPtr)(initial | (Int32)Ws.ExTransparent)); } }