예제 #1
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public override object Clone()
        {
            // Create a new instance of this class
            SeparatorCommand copy = new SeparatorCommand();

            // Make a note of the original we are cloned from
            Original = this;

            // Copy across the members values
            copy.UpdateInstance(this);

            return(copy);
        }
예제 #2
0
        private void buttonAddSeparator_Click(object sender, System.EventArgs e)
        {
            // Create a new button instance
            SeparatorCommand newSep = new SeparatorCommand();

            // Create a new tree node to hold the separator
            Node newNode = new Node("(Separator)");

            // Attached the separator to the node
            newNode.Tag = newSep;

            // Append to end of the list
            treeControl1.Nodes.Add(newNode);

            // Select the new entry
            newNode.Select();

            // Put focus back to the tree control
            treeControl1.Focus();

            UpdateButtonState();
        }