ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupGallery.UpdateParent C# (CSharp) 메소드

UpdateParent() 개인적인 메소드

private UpdateParent ( Control parentControl ) : void
parentControl Control
리턴 void
        private void UpdateParent(Control parentControl)
        {
            // Is there a change in the gallery or a change in
            // the parent control that is hosting the control...
            if ((parentControl != LastParentControl) ||
                (LastGallery != _ribbonGallery.Gallery))
            {
                // We only modify the parent and visible state if processing for correct container
                if ((_ribbonGallery.RibbonGroup.ShowingAsPopup && (parentControl is VisualPopupGroup)) ||
                    (!_ribbonGallery.RibbonGroup.ShowingAsPopup && !(parentControl is VisualPopupGroup)))
                {
                    // If we have added the custrom control to a parent before
                    if ((LastGallery != null) && (LastParentControl != null))
                    {
                        // If that control is still a child of the old parent
                        if (LastParentControl.Controls.Contains(LastGallery))
                        {
                            // Check for a collection that is based on the read only class
                            LastParentControl.Controls.Remove(LastGallery);
                        }
                    }

                    // Remove ribbon reference from old last gallery reference
                    if (LastGallery != null)
                        LastGallery.Ribbon = null;

                    // Remember the current control and new parent
                    LastGallery = _ribbonGallery.Gallery;
                    LastParentControl = parentControl;

                    // Add ribbon reference to new gallery reference
                    if (LastGallery != null)
                        LastGallery.Ribbon = _ribbon;

                    // If we have a new gallery and parent
                    if ((LastGallery != null) && (LastParentControl != null))
                    {
                        // Ensure the control is not in the display area when first added
                        LastGallery.Location = new Point(-LastGallery.Width, -LastGallery.Height);

                        // Check for the correct visible state of the gallery
                        UpdateVisible(LastGallery);
                        UpdateEnabled(LastGallery);

                        // Check for a collection that is based on the read only class
                        LastParentControl.Controls.Add(LastGallery);
                    }
                }
            }
        }