protected override void OnTimerTick(TimerEventArgs e) { if (e.TimerId == ActivityTimer) { IntPtr activeWindow = NativeMethods.GetForegroundWindow(); if (activeWindow != this.Handle) { if (menu.Active) { menu.CloseUp(); } } } base.OnTimerTick(e); }