コード例 #1
0
ファイル: Form1.cs プロジェクト: EAVologzhanin/TreeApp
        private void AddForm_AddSquare(object sender, EventArgs e)
        {
            AddNewCircle newCircle = (AddNewCircle)sender;

            CreateFigure(newCircle.chance, newCircle.info, newCircle.price, 1);
            ChangeMenuVisible(true);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: EAVologzhanin/TreeApp
        private void AddTriangle_MouseDown(object sender, MouseEventArgs e)
        {
            if (firstCircle == null)
            {
                firstCircle = new Triangle(new Point(300, Height / 2 - 141), 7, null, ref destDelegate, 1, "", 0);
                treeView1.Nodes.Add(new TreeNode("1"));
                Centre_Click(null, null);
                SaveToCtrlZ();
                ChangeMenuVisible(false);
            }
            else
            {
                SaveToCtrlZ();

                if (structureComboBox1.SelectedIndex == 0)// Если выбран graph, не показываем форму для введения информации
                {
                    CreateFigure(0, "", 0, 2);
                }
                else
                {
                    addForm              = new AddNewCircle();
                    addForm.closed      += AddForm_closed;
                    addForm.AddTriangle += AddForm_AddTriangle;

                    ChangeMenuVisible(false);
                    addForm.Show();
                    addForm.Location = new Point(pictureBox1.Width / 2 + panel1.Width / 3, pictureBox1.Height / 2 - addForm.Height / 2);
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: EAVologzhanin/TreeApp
 private void Change_Click(object sender, EventArgs e) // Изменить
 {
     SaveToCtrlZ();
     addForm              = new AddNewCircle();
     addForm.ChangeEvent += AddForm_Changed;
     addForm.closed      += AddForm_closed;
     ChangeMenuVisible(false);
     addForm.Show();
     addForm.Location = new Point(pictureBox1.Width / 2 + panel1.Width / 3, pictureBox1.Height / 2 - addForm.Height / 2);
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: EAVologzhanin/TreeApp
        private void AddForm_Changed(object sender, EventArgs e)
        {
            AddNewCircle newCircle = (AddNewCircle)sender;

            try
            {
                selectedFigure.information = newCircle.info;
                if (selectedFigure.parent is Square)
                {
                    selectedFigure.probablyToParent = 1;
                }
                else
                {
                    selectedFigure.probablyToParent = newCircle.chance;
                }
                selectedFigure.Price = newCircle.price;
                ChangeMenuVisible(true);
            } catch (NullReferenceException)//Обработка изменения 1 окружности
            {
                selectedFigure.probablyToParent = newCircle.chance;
            }
        }