Пример #1
0
        private void SquareDraw(int size, Byte[] color)
        {
            var foxDraw = new FoxDraw(canvas);

            foxDraw.FillColor(Color.FromRgb(color[0], color[1], color[2]));
            foxDraw.DrawRectangle(random.Next(0, 150), random.Next(0, 200), size, size);
        }
        public void RainbowBoxFiller(FoxDraw foxDraw, int boxSize)
        {
            byte [] trueRandomColor = new [] { (byte)random.Next(63), (byte)random.Next(63, 127), (byte)random.Next(127, 191), (byte)random.Next(191, 255) };
            byte    colorFragment   = trueRandomColor[random.Next(trueRandomColor.Length)];
            Color   randomColor     = Color.FromRgb(colorFragment, colorFragment, colorFragment);


            foxDraw.FillColor(Colors.Red);
            double x = 0.0;
            double y = 0.0;

            do
            {
                x = (foxDraw.Canvas.Width / 2) - (boxSize / 2);
                y = (foxDraw.Canvas.Height / 2) - (boxSize / 2);
                foxDraw.DrawRectangle(x, y, boxSize, boxSize);
                boxSize += 50;
                foxDraw.FillColor(randomColor);
            } while (x != 0.0);
        }
Пример #3
0
        public static void SquareDrawer(FoxDraw foxDrawer)
        {
            double x = 250;

            Random rnd = new Random();

            for (int i = 0; i < 7; i++)
            {
                foxDrawer.FillColor(Color.FromRgb((byte)rnd.Next(), (byte)rnd.Next(), (byte)rnd.Next()));
                foxDrawer.DrawRectangle(300 - x / 2, 300 - x / 2, x, x);
                x = x - i * 10;
            }
        }
Пример #4
0
        public void CenterSquareCreator(FoxDraw drawer, int size, Color color)
        {
            Point        coord  = new Point(canvas.Height / 2, canvas.Width / 2);
            List <Point> points = new List <Point>();

            points.Add(new Point(coord.X - size, coord.Y - size));
            points.Add(new Point(coord.X + size, coord.Y - size));
            points.Add(new Point(coord.X + size, coord.Y + size));
            points.Add(new Point(coord.X - size, coord.Y + size));

            drawer.FillColor(color);
            drawer.DrawPolygon(points);
        }
Пример #5
0
        public static void DrawGreenPolygon(FoxDraw foxDraw, int squareSide, int w)
        {
            var half = 150; //canvas.ActualHeight / 2;
            var x = half - squareSide / 2;
            var y = half + squareSide / 2;
            var points = new List<Point>();
            points.Add(new Point(x, x));
            points.Add(new Point(x, y));
            points.Add(new Point(y, y));
            points.Add(new Point(y, x));

            byte b = Convert.ToByte(w + 100);
            byte c = Convert.ToByte(150-w);
            byte d = Convert.ToByte((150-w)/2);
            foxDraw.FillColor(Color.FromRgb(b, c, d));
            foxDraw.DrawPolygon(points);
        }
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);
            // Create a square drawing function that takes 2 parameters:
            // The square size, and the fill color,
            // and draws a square of that size and color to the center of the canvas.
            // Create a loop that fills the canvas with rainbow colored squares.
            double size = 50; //;)

            Color[] color   = new Color[] { Colors.Brown, Colors.Pink, Colors.Green, Colors.Indigo, Colors.Purple, Colors.Yellow, Colors.Orange, Colors.Red };
            double  canvasW = canvas.Width;
            double  canvasH = canvas.Height;

            for (int i = 7; i >= 0; i--)
            {
                foxDraw.FillColor(color[i]);
                CenterSquarez(foxDraw, size * i, canvasW, canvasH);
            }
        }
Пример #7
0
 public static void DrawSquares(FoxDraw foxDraw, Color color, double x)
 {
     foxDraw.FillColor(color);
     foxDraw.DrawRectangle(262 - x / 2, 175 - x / 2, x, x);
 }
Пример #8
0
 public static void DrawBoxesCenter(FoxDraw foxDraw, double canvasSize, double size, Color color)
 {
     foxDraw.FillColor(color);
     foxDraw.DrawRectangle(((canvasSize - size) / 2), ((canvasSize - size) / 2), size, size);
 }