private void DrawCenterBox(int sizeX, int sizeY)
        {
            var foxDraw = new FoxDraw(canvas);

            foxDraw.FillColor(Colors.Transparent);
            foxDraw.DrawRectangle(canvas.Width / 2 - sizeX / 2, canvas.Height / 2 - sizeY / 2, sizeX, sizeY);
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            // create a square drawing function that takes 1 parameter:
            // the square size
            // and draws a square of that size to the center of the canvas.
            // draw 3 squares with that function.

            foxDraw.FillColor(Colors.Goldenrod);
            foxDraw.DrawSquare(210);

            foxDraw.FillColor(Colors.Maroon);
            foxDraw.DrawSquare(140);

            foxDraw.FillColor(Colors.Black);
            foxDraw.DrawSquare(70);
        }
        public static void DrawSquares(FoxDraw foxDraw)
        {
            Random r = new Random();
            double x = 340;

            for (int i = 0; i < 4; i++)
            {
                foxDraw.FillColor(Color.FromRgb((byte)r.Next(), (byte)r.Next(), (byte)r.Next()));
                foxDraw.DrawRectangle(262 - x / 2, 175 - x / 2, x, x);
                x = x - i * 50;
            }
        }
Beispiel #4
0
        public void DrawBoxToCenter(FoxDraw foxDraw, int boxSize)
        {
            byte  colorFragment = (byte)random.Next(255);
            Color randomColor   = Color.FromRgb(colorFragment, colorFragment, colorFragment);

            foxDraw.FillColor(randomColor);

            double x = (foxDraw.Canvas.Width / 2) - (boxSize / 2);
            double y = (foxDraw.Canvas.Height / 2) - (boxSize / 2);

            foxDraw.DrawRectangle(x, y, boxSize, boxSize);
        }
Beispiel #5
0
        public static void SquareDrawing(FoxDraw foxDraw)
        {
            double x   = 350;
            Random rnd = new Random();

            for (int i = 0; i < 4; i++)
            {
                foxDraw.FillColor(Color.FromRgb((byte)rnd.Next(), (byte)rnd.Next(), (byte)rnd.Next()));
                foxDraw.DrawRectangle(262 - x / 2, 175 - x / 2, x, x);
                x = x - i * 50;
            }
        }
Beispiel #6
0
        public static void DrawThreeSquares(FoxDraw foxDraw, double size)
        {
            Random random = new Random();

            for (int i = 0; i < 3; i++)
            {
                double centerX = (400 - size) / 2;
                double centerY = (400 - size) / 2;

                foxDraw.FillColor(Color.FromArgb(
                                      (byte)60,
                                      (byte)random.Next(255),
                                      (byte)random.Next(255),
                                      (byte)random.Next(255)));
                foxDraw.DrawRectangle(centerX, centerY, size, size);

                size = size / 2;
            }
        }
Beispiel #7
0
 public void CenterBox(int size, FoxDraw foxDraw, Random rnd)
 {
     foxDraw.FillColor(Color.FromArgb(RandomByte(rnd), RandomByte(rnd), RandomByte(rnd), RandomByte(rnd)));
     foxDraw.DrawRectangle((canvas.Width - size) / 2, (canvas.Height - size) / 2, size, size);
 }