Esempio n. 1
0
 private void open_q_and_a()
 {
     q_and_a = new WinNodes(factors, targets);
     q_and_a.StartPosition = FormStartPosition.CenterScreen;
     q_and_a.FormClosing  += this.Form1_WinNodeClosing;
     q_and_a.ShowDialog();
 }
Esempio n. 2
0
        //При закрытии окна выбора
        public void Form1_WinNodeClosing(object sender, FormClosingEventArgs e)
        {
            if (current_node == null)
            {
                return;
            }
            current_node.BackColor = System.Drawing.Color.White;
            Factor f = q_and_a.returner;

            q_and_a = null;
            if (f == null || current_node == null)
            {
                return;
            }
            if (f != null)
            {
                current_node.f_harness(f);
            }
            if (f.quest)
            {
                Question q = (Question)f;
                if (q.variants.Count == 0)
                {
                    return;
                }
                node_del(current_node);
                if (state == states.handle)
                {
                    double angle = (Math.PI / 2 / (q.variants.Count - 1));
                    for (int i = 0; i < q.variants.Count; i++)
                    {
                        current_node.variants.Add(new_node(new Point(current_node.Location.X + current_node.Width / 2 - 75 / 2 + (int)((200) * Math.Cos(i * angle)), current_node.Location.Y + (int)((200) * Math.Sin(i * angle)))));
                    }
                }
                else if (state == states.auto)
                {
                    tree.check_height();
                    current_node.variants.Add(new_node(new Point(current_node.Location.X + current_node.Width / 2 - 75 / 2 + 200, current_node.Location.Y + 50)));
                    for (int i = 1; i < q.variants.Count; i++)
                    {
                        current_node.variants.Add(new_node(new Point(current_node.Location.X + current_node.Width / 2 - 75 / 2 + 200, current_node.variants[i - 1].Location.Y + current_node.variants[i - 1].height)));
                    }
                }
                RDraw();
            }
        }