public override void Initialize(IComponent component) { base.Initialize(component); //"Component" is passed to the designer by the LcarsTabControl when it is added to a form. //We have to convert it from an IComponent to an LcarsTabControl. Since it's actually //already just an LcarsTabControl, we cast it's type (just to make it easy on ourselves later). myControl = (LcarsTabControl)component; //Here we're adding an event handler that will fire when something is added to our //control--in our case, LcarsTabPages. IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); c.ComponentRemoving += OnComponentRemoving; }
internal LcarsTabPageCollection(LcarsTabControl Control) { //When an LcarsTabControl creates it's TabPages collection, it passes itself as the single //parameter so we can tell what LcarsTabControl goes with the collection. Parent = Control; }