public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); // Fill the canvas with a checkerboard pattern. foxDraw.FillColor(Colors.Black); int cnt = 1; for (int i = 0; i < canvas.Width; i = i + 20) { for (int j = 0; j < canvas.Width; j = j + 10) { if (cnt % 2 == 0) { foxDraw.DrawRectangle(i + 10, j, 10, 10); } else { foxDraw.DrawRectangle(i, j, 10, 10); } cnt++; } } }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); // fill the canvas with a checkerboard pattern. int x = 0; int y = 0; foxDraw.FillColor(Colors.Black); for (int i = 1; i <= 8; i++) { for (int j = 0; j < 4; j++) { foxDraw.DrawRectangle(x, y, 30, 30); x += 60; } if (i % 2 == 1) { x = 30; } else { x = 0; } y += 30; } }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); // fill the canvas with a checkerboard pattern. foxDraw.BackgroundColor(Colors.Gold); double size = 75; double x = 0; double y = 0; //Squares(foxDraw, a, b); //Squares(foxDraw, a+75, b); //Squares(foxDraw, a, b+75); //Squares(foxDraw, a+75, b+75); for (int i = 0; i < 8; i++) { if (i % 2 == 1) { x += size; } for (int j = 0; j < 4; j++) { foxDraw.FillColor(Colors.Black); foxDraw.DrawRectangle(x, y, size, size); x += 2 * size; } x = 0; y += size; } }
public void Rectangle(int x, int y, int size, string colorString) { InitializeComponent(); var foxDraw = new FoxDraw(canvas); Color color = (Color)ColorConverter.ConvertFromString(colorString); foxDraw.FillColor(color); foxDraw.DrawRectangle(x, y, size, size); }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); double width = 0; double height = 0; int rule; for (int i = 0; i < 8; i++) { if (i % 2 == 0) { rule = 0; } else { rule = 1; } for (int j = 0; j < 8; j++) { if (j % 2 == rule) { foxDraw.FillColor(Colors.Black); foxDraw.StrokeColor(Colors.Black); foxDraw.DrawRectangle(width, height, canvas.Width / 8, canvas.Width / 8); width += canvas.Width / 8; } else { foxDraw.FillColor(Colors.White); foxDraw.StrokeColor(Colors.Black); foxDraw.DrawRectangle(width, height, canvas.Width / 8, canvas.Width / 8); width += canvas.Width / 8; } } height += canvas.Width / 8; width -= canvas.Height; } }
static void Checkers(FoxDraw foxDraw, double startPoint, double line, double canvasW, double canvasH) { for (int i = 0; i < 8; i++) { int draw = 0; if (i % 2 == 0) { draw = 0; } else if (i % 2 != 0) { draw = 1; } for (int j = 0; j <= 8; j++) { if (j == 8) { startPoint = 0; line = line + canvasH / 8; } else if (j % 2 == draw) { foxDraw.FillColor(Colors.Black); foxDraw.DrawRectangle(startPoint, line, canvasW / 8, canvasH / 8); startPoint = startPoint + canvasW / 8; } else if (j % 2 != draw) { foxDraw.FillColor(Colors.White); foxDraw.DrawRectangle(startPoint, line, canvasW / 8, canvasH / 8); startPoint = startPoint + canvasW / 8; } } } }
public MainWindow() { InitializeComponent(); var foxDraw = new FoxDraw(canvas); int fieldSize = 30; int numberOfFieldsInEdge = 8; for (int i = 0; i < numberOfFieldsInEdge; i++) { for (int j = 0; j < numberOfFieldsInEdge; j++) { foxDraw.FillColor((i + j) % 2 == 0 ? Colors.Red : Colors.Pink); foxDraw.DrawRectangle(fieldSize * j, fieldSize * i, fieldSize, fieldSize); } } }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); var canvas = this.Get <Canvas>("canvas"); var foxDraw = new FoxDraw(canvas); //// // Fill the canvas with a checkerboard pattern. int size = 10; double squaresPerLine = Width / size; double squaresPerColumn = Height / size; double offset = size; for (int i = 0; i < squaresPerColumn; i++) { for (int j = 0; j < squaresPerLine; j++) { if (i % 2 == 0) { if (j % 2 == 0) { foxDraw.SetFillColor(Colors.White); } else { foxDraw.SetFillColor(Colors.Black); } } else { if (j % 2 == 0) { foxDraw.SetFillColor(Colors.Black); } else { foxDraw.SetFillColor(Colors.White); } } foxDraw.DrawRectangle(j * offset, i * offset, size, size); } } #endif }
public static void DrawBlackSquares(FoxDraw foxDraw, double bx, double by, double bz) { foxDraw.FillColor(Colors.Black); foxDraw.DrawRectangle(bx, by, bz, bz); }
public static void DrawWhiteSquares(FoxDraw foxDraw, double wx, double wy, double wz) { foxDraw.FillColor(Colors.White); foxDraw.DrawRectangle(wx, wy, wz, wz); }