コード例 #1
0
 public FigurePainter(Brush brush, IFormFigure formFigure, Point startPoint, AbstractFilling typeOfFilling)
 {
     this.brush         = brush;
     this.formFigure    = formFigure;
     this.startPoint    = startPoint;
     this.typeOfFilling = typeOfFilling;
 }
コード例 #2
0
        public void DrawFigure(IFormFigure formFigure, Bitmap newBitmap, Point p1, PictureBox pictureBox)
        {
            List <Point> figurePoints = formFigure.CalculateFigure(startPoint, p1);

            if (formFigure is CircleForm || formFigure is EllipseForm)
            {
                for (int i = 0; i < figurePoints.Count - 1; i++)
                {
                    brush.DrawLine(figurePoints[i], figurePoints[i + 1], pictureBox, brush.currentColor, newBitmap);
                }
            }
            else
            {
                if (formFigure is CircleForm || formFigure is EllipseForm)
                {
                    for (int i = 0; i < figurePoints.Count; i++)
                    {
                        if (i != figurePoints.Count - 1)
                        {
                            brush.DrawLine(figurePoints[i], figurePoints[i + 1], pictureBox, brush.currentColor, newBitmap);
                        }
                        else
                        {
                            brush.DrawLine(figurePoints[i], figurePoints[0], pictureBox, brush.currentColor, newBitmap);
                        }
                    }
                }
            }
        }
コード例 #3
0
        public override AbstractPainter CreatePainter(IFormFigure currentFigure, Color currentColor, int currentSize, Point startPoint, AbstractFilling typeOfFilling)
        {
            Brush brush = new Brush(currentColor, currentSize);

            abstractPainter = new PointPolygonPainter(brush, currentFigure, startPoint);
            return(abstractPainter);
        }
コード例 #4
0
 public VectorFigurePainter(Brush brush, IFormFigure formFigure, Point startPoint, AbstractFilling typeOfFilling)
 {
     this.brush         = brush;
     this.formFigure    = formFigure;
     this.startPoint    = startPoint;
     this.typeOfFilling = typeOfFilling;
     points             = formFigure.CalculateFigure(startPoint, startPoint);
 }
コード例 #5
0
        public override AbstractPainter CreatePainter(IFormFigure currentFigure, Color currentColor, int currentSize, Point startPoint, AbstractFilling typeOfFilling)
        {
            Brush brush = new Brush(currentColor, currentSize);

            abstractPainter = new VectorFigurePainter(brush, currentFigure, startPoint, typeOfFilling);
            Canvas.GetCanvas.figures.Insert(0, abstractPainter);

            return(abstractPainter);
        }
コード例 #6
0
 private void buttonOval_Click(object sender, EventArgs e)
 {
     if (vectorMode)
     {
         currentFactory = new VectorFigurePainterFactory();
     }
     else
     {
         currentFactory = new FigurePainterFactory();
     }
     currentForm  = new EllipseForm();
     buttonSwitch = new NoneButton();
 }
コード例 #7
0
 private void buttonPolygon1_Click(object sender, EventArgs e)
 {
     if (vectorMode)
     {
         currentFactory = new VectorFigurePainterFactory();
     }
     else
     {
         currentFactory = new FigurePainterFactory();
     }
     currentForm  = new PolygonForm(Convert.ToInt32(numericUpDownForPolygon.Value));
     buttonSwitch = new NoneButton();
 }
コード例 #8
0
 private void buttonRightTriangle_Click(object sender, EventArgs e)
 {
     if (vectorMode)
     {
         currentFactory = new VectorFigurePainterFactory();
     }
     else
     {
         currentFactory = new FigurePainterFactory();
     }
     currentForm  = new RecTriangleForm();
     buttonSwitch = new NoneButton();
 }
コード例 #9
0
 public PointPolygonPainter(Brush brush, IFormFigure formFigure, Point startPoint)
 {
     this.brush      = brush;
     this.formFigure = formFigure;
     if (first.X == -1)
     {
         first = startPoint;
         last  = startPoint;
     }
     else
     {
     }
 }
コード例 #10
0
ファイル: PolygonTests.cs プロジェクト: loopu05/risovalka
        public void SetPolygonSides()
        {
            switch (sides)
            {
            case 3:
                figure = new PolygonForm(sides);
                break;

            case 4:
                figure = new PolygonForm(sides);
                break;

            case 5:
                figure = new PolygonForm(sides);
                break;
            }
        }
コード例 #11
0
ファイル: Brush.cs プロジェクト: loopu05/risovalka
 public void DrawFigure(IFormFigure formFigure, Bitmap newBitmap, PictureBox pictureBox, List <Point> figurePoints)
 {
     if (formFigure is CircleForm || formFigure is EllipseForm)
     {
         for (int i = 0; i < figurePoints.Count - 1; i++)
         {
             this.DrawLine(figurePoints[i], figurePoints[i + 1], pictureBox, this.currentColor, newBitmap);
         }
     }
     else
     {
         for (int i = 0; i < figurePoints.Count; i++)
         {
             if (i != figurePoints.Count - 1)
             {
                 this.DrawLine(figurePoints[i], figurePoints[i + 1], pictureBox, this.currentColor, newBitmap);
             }
             else
             {
                 this.DrawLine(figurePoints[i], figurePoints[0], pictureBox, this.currentColor, newBitmap);
             }
         }
     }
 }
コード例 #12
0
 private void buttonPolygon2_Click(object sender, EventArgs e)
 {
     currentFactory = new PointPolygonPainterFactory();
     currentForm    = new LineForm();
     buttonSwitch   = new NoneButton();
 }
コード例 #13
0
 private void buttonEraser_Click(object sender, EventArgs e)
 {
     currentFactory = new ErasePainterFactory();
     currentForm    = new LineForm();
     buttonSwitch   = new NoneButton();
 }
コード例 #14
0
 private void numericUpDownForPolygon_ValueChanged(object sender, EventArgs e)
 {
     currentForm = new PolygonForm(Convert.ToInt32(numericUpDownForPolygon.Value));
 }
コード例 #15
0
 public LinePainter(Brush brush, IFormFigure formFigure, Point startPoint)
 {
     this.brush      = brush;
     this.formFigure = formFigure;
     this.startPoint = startPoint;
 }
コード例 #16
0
ファイル: APainterFactory.cs プロジェクト: loopu05/risovalka
 abstract public AbstractPainter CreatePainter(IFormFigure currentFigure, Color currentColor, int currentSize, Point startPoint, AbstractFilling typeOfFilling);