コード例 #1
0
 public void MouseDown(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e)
 {
     foreach (Drawfigure f in canvas.figures)
     {
         if (f.figure.IsInside(e.Location))
         {
             activeFigure = f;
             cursorActive = true;
             canvas.RenderExceptFigure(activeFigure);
             canvas.SaveToCache();
         }
     }
 }
コード例 #2
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);
            }
        }
コード例 #3
0
 public void MouseDown(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e)
 {
     foreach (Drawfigure f in canvas.figures)
     {
         if (f.figure.IsInside(e.Location))
         {
             activeFigure    = f;
             index           = canvas.figures.IndexOf(activeFigure);
             activeFigureTmp = canvas.figuresTmp[index];
             for (int i = 0; i < activeFigureTmp.figure.dotlist.Count; i++)
             {
                 activeFigure.figure.dotlist[i] = activeFigureTmp.figure.dotlist[i];
             }
             activeFigure.brush = activeFigureTmp.brush;
             activeFigure.fill  = activeFigureTmp.fill;
             cursorActive       = true;
             canvas.SaveToCache();
         }
     }
 }
コード例 #4
0
        public void MouseClick(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e)
        {
            foreach (Drawfigure f in canvas.figures)
            {
                if (f.figure.IsInside(e.Location))
                {
                    activeFigure = f;

                    cursorActive = true;
                    canvas.RenderExceptFigure(activeFigure);
                    canvas.SaveToCache();
                }
            }

            if (activeFigure != null)
            {
                activeFigure.figure.ChangeCorners();
                canvas.PointChangeModeOfRectangle(sheet, activeFigure);
                havecorners = true;
            }
        }