예제 #1
0
파일: Form1.cs 프로젝트: datrax/BinaryTree
 private void BuildTree(object sender, EventArgs e)
 {
     TreeViewer treeViewer = new TreeViewer(xItems.ToArray(),yItems.ToArray());
     treeViewer.Owner = this;
     treeViewer.Text += " "+OwnedForms.Length;
     treeViewer.Show();
 }
예제 #2
0
 private void Merge(object sender, EventArgs e)
 {
     TreeViewer treeViewer=new TreeViewer();
     treeViewer.treap = Treap.Merge(((TreeViewer)this.Owner).treap, ((TreeViewer)this.Owner.Owner.OwnedForms[listBox1.SelectedIndex]).treap);
     treeViewer.Owner = this.Owner.Owner;
     treeViewer.Text += " " + this.Owner.Owner.OwnedForms.Length;
     this.Close();
     treeViewer.Show();
 }
예제 #3
0
        private void SplitTree(object sender, EventArgs e)
        {
            int n;
            if (!Int32.TryParse(textBox4.Text, out n))
            {
                MessageBox.Show("Wrong number");
                return;
            }
            if (n == -1)
            {
                MessageBox.Show("There is no such element");
                return;
            }
            Treap leftTree;
            Treap rightTree;
            TreeViewer treeViewer = new TreeViewer();

            treap.Split(n, out leftTree, out rightTree);

            treeViewer.treap = leftTree;
            treeViewer.Owner = this.Owner;
            treeViewer.Show();
            treeViewer.Text += " " + this.Owner.OwnedForms.Length;
            TreeViewer treeViewer1 = new TreeViewer();
            treeViewer1.treap = rightTree;
            treeViewer1.Owner = this.Owner;
            treeViewer1.Show();
            treeViewer1.Text += " " + this.Owner.OwnedForms.Length;
        }