private void ActiveWindowChanged(object sender, ActiveWindowChangedEventArgs e) { if (e.Old == this) OnDeactivated(EventArgs.Empty); if (e.New == this) OnActivated(EventArgs.Empty); }