public static void DrawSquareInPosition(FoxDraw foxDraw, int x, int y)
        {
            Random rnd = new Random();

            foxDraw.FillColor(Color.FromRgb((byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255)));

            foxDraw.DrawRectangle(x, y, 50, 50);
        }
예제 #2
0
        private void PositionSquare(FoxDraw foxDraw, Random rnd)
        {
            double x1 = rnd.Next(300);
            double y1 = rnd.Next(300);

            double a = 50;

            foxDraw.FillColor(Color.FromRgb((byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255), (byte)rnd.Next(0, 255)));
            foxDraw.DrawRectangle(x1, y1, a, a);
        }
예제 #3
0
        public void DrawSquare()
        {
            var foxDraw = new FoxDraw(canvas);

            for (int i = 1; i < 4; i++)
            {
                double x = 10 + i * 50;
                double y = 10 + i * 50;

                foxDraw.FillColor(Colors.ForestGreen);
                foxDraw.DrawRectangle(x, y, 50, 50);
            }
        }
예제 #4
0
        public MainWindow()
        {
            InitializeComponent();
            var foxDraw = new FoxDraw(canvas);

            foxDraw.BackgroundColor(Colors.Linen);
            // create a square drawing function that takes 2 parameters:
            // the x and y coordinates of the square's top left corner
            // and draws a 50x50 square from that point.
            // draw 3 squares with that function.
            foxDraw.FillColor(Colors.DodgerBlue);
            foxDraw.DrawSquare(45, 55);
            foxDraw.DrawSquare(95, 95);
            foxDraw.DrawSquare(145, 125);
        }
예제 #5
0
        public static void DrawThreeSquares(FoxDraw foxDraw, double x1, double y1)
        {
            Random random = new Random();

            for (int i = 0; i < 3; i++)
            {
                foxDraw.FillColor(Color.FromArgb(
                    (byte)70,
                    (byte)random.Next(255),
                    (byte)random.Next(255),
                    (byte)random.Next(255)));
                foxDraw.DrawRectangle(x1, y1, 50, 50);

                x1 += (double)random.Next(100);
                y1 += (double)random.Next(100);
            }
        }