/// <summary> /// Fires the <see cref="SmartPartActivated"/> event whenever /// the selected tab index changes. /// </summary> /// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param> protected override void OnSelectedIndexChanged(EventArgs e) { base.OnSelectedIndexChanged(e); if (callComposerActivateOnIndexChange && TabPages.Count != 0) { // Locate the smart part corresponding to the page. foreach (KeyValuePair <Control, TabPage> pair in pages) { if (pair.Value == this.SelectedTab) { ((IComposableWorkspace <Control, TabSmartPartInfo>) this).Activate(pair.Key); return; } } // If we got here, we couldn't find a corresponding smart part for the // currently active tab, hence we reset the ActiveSmartPart value. composer.SetActiveSmartPart(null); } }
private void SmartPartEntered(object sender, EventArgs e) { Control control = sender as Control; if (control != null) { ((IComposableWorkspace <Control, ZoneSmartPartInfo>) this).Activate(control); } else { composer.SetActiveSmartPart(null); } }