Выбрать главу

                     //go_first

                     listFigure.start();

                     if(!listFigure.empty())

                           current = listFigure.item();

               }

               private void menuItem35_Click(object sender, System.EventArgs e)

               {

                     //go_last

                     listFigure.finish();

                     if(!listFigure.empty())

                           current = listFigure.item();

                }

                private void menuItem15_Click(object sender, System.EventArgs e)

                {

                     showList ();

                }

                void showList ()

                {

                     //Show List

                     listFigure.start();

                     while(listFigure.Index <= listFigure.Count)

                     {

                           current = listFigure.item();

                           current.Show(graphic,pen,brush);

                           listFigure.go_next();

                     }

                     listFigure.finish ();

                }

                private void menuItem16_Click(object sender,

                     System.EventArgs e)

                {

                     clearList ();

                }

                void clearList ()

                {

                     //Clear List

                     listFigure.start();

                     while(!listFigure.empty())

                     {

                          current = listFigure.item();

                          current.Show(graphic,clearPen,clearBrush);

                          listFigure.remove ();

                     }

                }

                private void Form1_MouseMove (object sender,

                     System.Windows.Forms.MouseEventArgs e)

                {

                     if((current!= null) && current.dragged_figure)

                     {

                          current.Show(graphic,clearPen,clearBrush);

                          Point pt = new Point(e.X, e.Y);

                          current.center_figure = pt;

                          current.Show(graphic,pen,brush);

                     }

                }

                private void Form1_MouseUp(object sender,

                     System.Windows.Forms.MouseEventArgs e)

                {

                     current.dragged_figure = false;

                }

                private void Form1_MouseDown(object sender,

                     System.Windows.Forms.MouseEventArgs e)

                {

                     Point mousePoint = new Point (e.X, e.Y);

                     Rectangle figureRect = current.Region_Capture();

                     if ((current!= null) &&

                        (figureRect.Contains(mousePoint)))

                        current.dragged_figure = true;

                }

                protected override void

                     OnPaint(System.Windows.Forms.PaintEventArgs e)

                {

                     //show current figure

                      current.Show(graphic, pen, brush);

                }

                private void toolBar1_ButtonClick(object sender,

                      System.Windows.Forms.ToolBarButtonClickEventArgs e)

                {

                      int buttonNumber =

                          toolBar1.Buttons.IndexOf(e.Button);

                      switch (buttonNumber)

                      {

                           case 0:

                                 createEllipse (); break;

                           case 1:

                                 createCircle(); break;

                           case 2:

                                 createLittleCircle(); break;

                           case 3:

                                 createRectangle(); break;

                           case 4:

                                 createSquare(); break;

                           case 5:

                                 createPerson (); break;

                           case 6:

                                 showCurrent (); break;

                           case 7:

                                 clearCurrent (); break;

                           case 8:

                                 showList (); break;

                           case 9:

                                 clearList (); break;

                           case 10:

                                 incScale (); break;

                           case 11:

                                 decScale (); break;

                           case 12: