Example #1
0
        //Occurs when the New Canvas button is clicked. Cleans up any threads from previous
        //drawers, then starts a new drawer.
        private void button1_Click(object sender, EventArgs e)
        {
            //tells our threads to finish, then waits a moment for them to do so
            isAlive = false;
            Thread.Sleep(100);
            isAlive = true;

            if (canvas != null)
                canvas.Close();

            //creates a new CTracker using form values
            canvas = new CTracker((int)numericUpDownWidth.Value, (int)numericUpDownHeight.Value);
            canvas.Scale = (int)numericUpDownScale.Value;
            canvas.Position = new Point(Location.X + Width, Location.Y);

            //assigns our event handler to the event created in CTracker
            canvas.Full += canvas_Full;

            listView1.Items.Clear();
            thList = new List<Thread>();
            timer1.Enabled = true;
        }
Example #2
0
 //custom constructor, initializes our class members
 public Wanderer(Point startPoint, Color wColor, CTracker drawer)
 {
     pStack = new Stack<Point>();
     pStack.Push(startPoint);
     wanderColor = wColor;
     canv = drawer;
     rnd = new Random();
 }
Example #3
0
 //custom constructor leveraging the base
 public RandomWanderer(Point p, Color c, CTracker d)
     : base(p, c, d)
 {
 }