Exemple #1
0
 private void Random_Pair_Click_Array(string[] A)
 {
     for (int i = 0; i < Line_Array.Length; i++)
     {
         Line_Array[i].Show(canvas, false);
         My_Line obj = new My_Line(canvas);
         My_List_Line[My_List_Line.IndexOf(Line_Array[i])] = obj;
         Line_Array[i] = obj;
         Line_Array[i].Show(canvas, false);
     }
     for (int i = 0; i < Rect_Array.Length; i++)
     {
         Rect_Array[i].Show(canvas, false);
         My_Rectangle obj1 = new My_Rectangle(canvas);
         My_List_Rect[My_List_Rect.IndexOf(Rect_Array[i])] = obj1;
         Rect_Array[i] = obj1;
         Rect_Array[i].Show(canvas, false);
     }
     for (int i = 0; i < Ell_Array.Length; i++)
     {
         Ell_Array[i].Show(canvas, false);
         My_Ellipse obj2 = new My_Ellipse(canvas);
         My_List_Ell[My_List_Ell.IndexOf(Ell_Array[i])] = obj2;
         Ell_Array[i] = obj2;
         Ell_Array[i].Show(canvas, false);
     }
     for (int i = 0; i < Circ_Array.Length; i++)
     {
         Circ_Array[i].Show(canvas, false);
         My_Circle obj3 = new My_Circle(canvas);
         My_List_Circ[My_List_Circ.IndexOf(Circ_Array[i])] = obj3;
         Circ_Array[i] = obj3;
         Circ_Array[i].Show(canvas, false);
     }
     for (int i = 0; i < Arr_Array.Length; i++)
     {
         Arr_Array[i].Show(canvas, false);
         My_Arrow obj4 = new My_Arrow(canvas);
         My_List_Arr[My_List_Arr.IndexOf(Arr_Array[i])] = obj4;
         Arr_Array[i] = obj4;
         Arr_Array[i].Show(canvas, false);
     }
     for (int i = 0; i < Romb_Array.Length; i++)
     {
         Romb_Array[i].Show(canvas, false);
         My_Romb obj4 = new My_Romb(canvas);
         My_List_Romb[My_List_Romb.IndexOf(Romb_Array[i])] = obj4;
         Romb_Array[i] = obj4;
         Romb_Array[i].Show(canvas, false);
     }
     for (int i = 0; i < Trap_Array.Length; i++)
     {
         Trap_Array[i].Show(canvas, false);
         My_Trap obj4 = new My_Trap(canvas);
         My_List_Trap[My_List_Trap.IndexOf(Trap_Array[i])] = obj4;
         Trap_Array[i] = obj4;
         Trap_Array[i].Show(canvas, false);
     }
 }
Exemple #2
0
 private void Random_Create_Click(object sender, RoutedEventArgs e)
 {
     if (Changed_figure == "Line")
     {
         My_Line obj = new My_Line(canvas);
         Add_to_ComboBox(obj, Count_Line);
         My_List_Line.Add(obj);
         My_List_Line[Count_Line++].Show(canvas, false);
     }
     if (Changed_figure == "Rectangle")
     {
         My_Rectangle obj = new My_Rectangle(canvas);
         Add_to_ComboBox(obj, Count_Rect);
         My_List_Rect.Add(obj);
         My_List_Rect[Count_Rect++].Show(canvas, false);
     }
     if (Changed_figure == "Arrow")
     {
         My_Arrow obj = new My_Arrow(canvas);
         Add_to_ComboBox(obj, Count_Arr);
         My_List_Arr.Add(obj);
         My_List_Arr[Count_Arr++].Show(canvas, false);
     }
     if (Changed_figure == "Ellipse")
     {
         My_Ellipse obj = new My_Ellipse(canvas);
         Add_to_ComboBox(obj, Count_Ell);
         My_List_Ell.Add(obj);
         My_List_Ell[Count_Ell++].Show(canvas, false);
     }
     if (Changed_figure == "Circle")
     {
         My_Circle obj = new My_Circle(canvas);
         Add_to_ComboBox(obj, Count_Circ);
         My_List_Circ.Add(obj);
         My_List_Circ[Count_Circ++].Show(canvas, false);
     }
     if (Changed_figure == "Romb")
     {
         My_Romb obj = new My_Romb(canvas);
         Add_to_ComboBox(obj, Count_Romb);
         My_List_Romb.Add(obj);
         My_List_Romb[Count_Romb++].Show(canvas, false);
     }
     if (Changed_figure == "Trap")
     {
         My_Trap obj = new My_Trap(canvas);
         Add_to_ComboBox(obj, Count_Trap);
         My_List_Trap.Add(obj);
         My_List_Trap[Count_Trap++].Show(canvas, false);
     }
 }
Exemple #3
0
        private void Canvas_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (Change == "Move")
            {
                try
                {
                    string[] A = ComboBox.Text.Split(new char[] { '.' });
                    if (ComboBox.Text != "" && isEmpty())
                    {
                        if (A[1] == "My_Line")
                        {
                            My_List_Line[Convert.ToInt32(A[2])].MoveTo(e, canvas, start_X, start_Y);
                        }
                        if (A[1] == "My_Rectangle")
                        {
                            My_List_Rect[Convert.ToInt32(A[2])].MoveTo(e, canvas, start_X, start_Y);
                        }
                        if (A[1] == "My_Ellipse")
                        {
                            My_List_Ell[Convert.ToInt32(A[2])].MoveTo(e, canvas, start_X, start_Y);
                        }
                        if (A[1] == "My_Circle")
                        {
                            My_List_Circ[Convert.ToInt32(A[2])].MoveTo(e, canvas, start_X, start_Y);
                        }
                        if (A[1] == "My_Arrow")
                        {
                            My_List_Arr[Convert.ToInt32(A[2])].MoveTo(e, canvas, start_X, start_Y);
                        }
                        if (A[1] == "My_Romb")
                        {
                            My_List_Romb[Convert.ToInt32(A[2])].MoveTo(e, canvas, start_X, start_Y);
                        }
                        if (A[1] == "My_Trap")
                        {
                            My_List_Trap[Convert.ToInt32(A[2])].MoveTo(e, canvas, start_X, start_Y);
                        }
                    }

                    foreach (My_Line i in Line_Array)
                    {
                        i.MoveTo(e, canvas, start_X, start_Y);
                    }
                    foreach (My_Rectangle i in Rect_Array)
                    {
                        i.MoveTo(e, canvas, start_X, start_Y);
                    }
                    foreach (My_Circle i in Circ_Array)
                    {
                        i.MoveTo(e, canvas, start_X, start_Y);
                    }
                    foreach (My_Arrow i in Arr_Array)
                    {
                        i.MoveTo(e, canvas, start_X, start_Y);
                    }
                    foreach (My_Ellipse i in Ell_Array)
                    {
                        i.MoveTo(e, canvas, start_X, start_Y);
                    }
                    foreach (My_Romb i in Romb_Array)
                    {
                        i.MoveTo(e, canvas, start_X, start_Y);
                    }
                    foreach (My_Trap i in Trap_Array)
                    {
                        i.MoveTo(e, canvas, start_X, start_Y);
                    }
                }
                catch
                {
                    MessageBox.Show("Выберите элемент из ChekBox");
                }
            }
            if (Change == "Create")
            {
                if (Changed_figure == "Line")
                {
                    My_Line obj = new My_Line(e, start_X, start_Y, isMenuCaptured);
                    Add_to_ComboBox(obj, Count_Line);
                    My_List_Line.Add(obj);
                    My_List_Line[Count_Line++].Show(canvas, false);
                }
                if (Changed_figure == "Rectangle")
                {
                    My_Rectangle obj = new My_Rectangle(start_X, start_Y, e.GetPosition(null).X, e.GetPosition(null).Y, isMenuCaptured);
                    Add_to_ComboBox(obj, Count_Rect);
                    My_List_Rect.Add(obj);
                    My_List_Rect[Count_Rect++].Show(canvas, false);
                }
                if (Changed_figure == "Arrow")
                {
                    My_Arrow obj = new My_Arrow(e, start_X, start_Y, isMenuCaptured);
                    Add_to_ComboBox(obj, Count_Arr);
                    My_List_Arr.Add(obj);
                    My_List_Arr[Count_Arr++].Show(canvas, false);
                }
                if (Changed_figure == "Ellipse")
                {
                    My_Ellipse obj = new My_Ellipse(e.GetPosition(null).X, e.GetPosition(null).Y, start_X, start_Y, isMenuCaptured, canvas);
                    Add_to_ComboBox(obj, Count_Ell);
                    My_List_Ell.Add(obj);
                    My_List_Ell[Count_Ell++].Show(canvas, false);
                }
                if (Changed_figure == "Circle")
                {
                    My_Circle obj = new My_Circle(e.GetPosition(null).X, e.GetPosition(null).Y, start_X, start_Y, isMenuCaptured, canvas);
                    Add_to_ComboBox(obj, Count_Circ);
                    My_List_Circ.Add(obj);
                    My_List_Circ[Count_Circ++].Show(canvas, false);
                }
                if (Changed_figure == "Romb")
                {
                    My_Romb obj = new My_Romb(e.GetPosition(null).X, e.GetPosition(null).Y, start_X, start_Y, isMenuCaptured);
                    Add_to_ComboBox(obj, Count_Romb);
                    My_List_Romb.Add(obj);
                    My_List_Romb[Count_Romb++].Show(canvas, false);
                }
                if (Changed_figure == "Trap")
                {
                    My_Trap obj = new My_Trap(e.GetPosition(null).X, e.GetPosition(null).Y, start_X, start_Y, isMenuCaptured);
                    Add_to_ComboBox(obj, Count_Trap);
                    My_List_Trap.Add(obj);
                    My_List_Trap[Count_Trap++].Show(canvas, false);
                }
            }
        }
Exemple #4
0
        private void Random_Pair_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string[] A = ComboBox.Text.Split(new char[] { '.' });
                if (ComboBox.Text != "" && isEmpty())
                {
                    if (A[1] == "My_Line")
                    {
                        My_List_Line[Convert.ToInt32(A[2])].Show(canvas, false);
                        My_Line obj = new My_Line(canvas);
                        My_List_Line[Convert.ToInt32(A[2])] = obj;
                        My_List_Line[Convert.ToInt32(A[2])].Show(canvas, false);
                    }
                    if (A[1] == "My_Rectangle")
                    {
                        My_List_Rect[Convert.ToInt32(A[2])].Show(canvas, false);
                        My_Rectangle obj = new My_Rectangle(canvas);
                        My_List_Rect[Convert.ToInt32(A[2])] = obj;
                        My_List_Rect[Convert.ToInt32(A[2])].Show(canvas, false);
                    }
                    if (A[1] == "My_Ellipse")
                    {
                        My_List_Ell[Convert.ToInt32(A[2])].Show(canvas, false);
                        My_Ellipse obj = new My_Ellipse(canvas);
                        My_List_Ell[Convert.ToInt32(A[2])] = obj;
                        My_List_Ell[Convert.ToInt32(A[2])].Show(canvas, false);
                    }
                    if (A[1] == "My_Circle")
                    {
                        My_List_Circ[Convert.ToInt32(A[2])].Show(canvas, false);
                        My_Circle obj = new My_Circle(canvas);
                        My_List_Circ[Convert.ToInt32(A[2])] = obj;
                        My_List_Circ[Convert.ToInt32(A[2])].Show(canvas, false);
                    }
                    if (A[1] == "My_Arrow")
                    {
                        My_List_Arr[Convert.ToInt32(A[2])].Show(canvas, false);
                        My_Arrow obj = new My_Arrow(canvas);
                        My_List_Arr[Convert.ToInt32(A[2])] = obj;
                        My_List_Arr[Convert.ToInt32(A[2])].Show(canvas, false);
                    }
                    if (A[1] == "My_Romb")
                    {
                        My_List_Romb[Convert.ToInt32(A[2])].Show(canvas, false);
                        My_Romb obj = new My_Romb(canvas);
                        My_List_Romb[Convert.ToInt32(A[2])] = obj;
                        My_List_Romb[Convert.ToInt32(A[2])].Show(canvas, false);
                    }
                    if (A[1] == "My_Trap")
                    {
                        My_List_Trap[Convert.ToInt32(A[2])].Show(canvas, false);
                        My_Trap obj = new My_Trap(canvas);
                        My_List_Trap[Convert.ToInt32(A[2])] = obj;
                        My_List_Trap[Convert.ToInt32(A[2])].Show(canvas, false);
                    }
                }

                Random_Pair_Click_Array(A);
            }
            catch (Exception er)
            {
            }
        }