コード例 #1
0
 public void MouseMove(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e)
 {
     if (cursorActive)
     {
         canvas.LoadFromCache();
         canvas.Turn(activeFigure);
         activeFigure.Draw(canvas);
         canvas.WriteToPictureBox(sheet);
     }
 }
コード例 #2
0
 public void MouseMove(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e)
 {
     if (cursorActive)
     {
         canvas.LoadFromCache();
         dx = e.X - tmpPoint.X;
         dy = e.Y - tmpPoint.Y;
         activeFigure.figure.MoveFigure(dx, dy);
         tmpPoint = e.Location;
         activeFigure.Draw(canvas);
         canvas.WriteToPictureBox(sheet);
     }
 }
コード例 #3
0
 public void MouseUp(PictureBox sheet, IBrush brushFig, IFill fillFig, MouseEventArgs e)
 {
     activeFigure.brush = (IBrush)brushFig.Clone();
     activeFigure.fill  = (IFill)fillFig.Clone();
     cursorActive       = false;
     canvas.Render();
     canvas.WriteToPictureBox(sheet);
 }
コード例 #4
0
        public void MouseMove(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e)
        {
            if (cursorActive)
            {
                if (activeFigure != null)
                {
                    canvas.LoadFromCache();
                    dx = e.X - tmpPoint.X;
                    dy = e.Y - tmpPoint.Y;
                    activeFigure.figure.ChangeSizeFigure(dx, dy, activecorner);

                    tmpPoint = e.Location;
                    activeFigure.Draw(canvas);
                    canvas.PointChangeModeOfRectangle(sheet, activeFigure);
                    canvas.WriteToPictureBox(sheet);
                }
            }
        }
コード例 #5
0
        public void MouseDown(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e)
        {
            cursorActive = true;
            for (int i = -10; i <= 10; i++)
            {
                for (int j = -10; j <= 10; j++)
                {
                    Point p = new Point(e.X + i, e.Y + j);
                    activeFigure = canvas.FindFigureByPoint(p);
                    if (activeFigure != null)
                    {
                        tmpIndex = canvas.FindPointByPoint(p);
                        break;
                    }
                }
                if (activeFigure != null)
                {
                    break;
                }
            }

            //для дабл клика(добавления вершин)
            if (activeFigure == null)
            {
                cursorActive = false;
                foreach (Drawfigure f in canvas.figures)
                {
                    if (f.figure.IsInside(e.Location))
                    {
                        activeFigure = f;
                    }
                }
            }
            //---------
            if (activeFigure != null)
            {
                canvas.RenderExceptFigure(activeFigure);
                canvas.SaveToCache();
                activeFigure.Draw(canvas);
                canvas.WriteToPictureBox(sheet);
            }
        }
コード例 #6
0
 public void MouseUp(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e)
 {
     cursorActive = false;
     canvas.Render();
     canvas.WriteToPictureBox(sheet);
 }