ComponentFactory.Krypton.Ribbon.KryptonRibbonGroupLinesDesigner.OnAddTextBox C# (CSharp) Метод

OnAddTextBox() приватный Метод

private OnAddTextBox ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void OnAddTextBox(object sender, EventArgs e)
        {
            if ((_ribbonLines != null) &&
                (_ribbonLines.Ribbon != null) &&
                 _ribbonLines.RibbonGroup.Items.Contains(_ribbonLines))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction("KryptonRibbonGroupLines AddTextBox");

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

                    RaiseComponentChanging(propertyItems);

                    // Get designer to create a textbox item
                    KryptonRibbonGroupTextBox tb = (KryptonRibbonGroupTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTextBox));
                    _ribbonLines.Items.Add(tb);

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