ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupTextBoxDesigner.OnDeleteTextBox C# (CSharp) Méthode

OnDeleteTextBox() private méthode

private OnDeleteTextBox ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Résultat void
        private void OnDeleteTextBox(object sender, EventArgs e)
        {
            if ((_ribbonTextBox != null) && (_ribbonTextBox.Ribbon != null))
            {
                // Get access to the parent collection of items
                TypedRestrictCollection<KryptonRibbonGroupItem> items = ParentItems;

                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupTextBox DeleteTextBox");

                try
                {
                    // Get access to the Items property
                    MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonTextBox.RibbonContainer)["Items"];

                    RaiseComponentChanging(null);
                    RaiseComponentChanging(propertyItems);

                    // Remove the textbox from the group
                    items.Remove(_ribbonTextBox);

                    // Get designer to destroy it
                    _designerHost.DestroyComponent(_ribbonTextBox);

                    RaiseComponentChanged(propertyItems, null, null);
                    RaiseComponentChanged(null, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    if (transaction != null)
                        transaction.Commit();
                }
            }
        }