Exemple #1
0
 public Fractal(Turtle turtle, Image canvas)
 {
     this.turtle = turtle;
     this.canvas = canvas;
 }
Exemple #2
0
        private void init()
        {
            this.pbCanvas.Image = new Bitmap(CSLogoForm.WIDTH, CSLogoForm.HEIGHT);
            this.pbCanvas.SizeMode = PictureBoxSizeMode.StretchImage;
            this.clearImage();

            this.turtle = new Turtle(50, 200, 0);
            this.fractal = new Fractal(this.turtle, this.pbCanvas.Image);

            this.cbFractalType.Items.Add(Fractal.FRACTAL_KOCH);
            this.cbFractalType.Items.Add(Fractal.FRACTAL_KOCHWAIT);
            this.cbFractalType.Items.Add(Fractal.FRACTAL_KOCHEXTRA);
            this.cbFractalType.SelectedIndex = this.cbFractalType.Items.IndexOf(Fractal.FRACTAL_KOCH);
        }
Exemple #3
0
        private void initDemo()
        {
            this.pbCanvasDemo.Image = new Bitmap(TestForm.WIDTH, TestForm.HEIGHT);
            this.pbCanvasDemo.SizeMode = PictureBoxSizeMode.StretchImage;

            Graphics g = Graphics.FromImage(this.pbCanvasDemo.Image);
            g.Clear(Color.White);
            g.DrawRectangle(Pens.Black, 0, 0, TestForm.WIDTH - 1, TestForm.HEIGHT - 1);

            this.pbCanvasDemo.Invalidate();

            this.sampleTurtle = new Turtle(TestForm.WIDTH / 2, TestForm.HEIGHT / 2, 0);
            this.sampleTurtle.SetPen(this.pColor.BackColor, (int)this.nudPenWidth.Value);
            this.sampleTurtle.Left(90);
            this.sampleTurtle.ShowTurtle();
        }