LowTds 0 Newbie Poster

Hello, I have been trying to get this robot to work out and be able to move around. I am just so confused as to how to get my arrow to get even displayed and moved when pressed by one of the directions to go.

One area that I struggle with is the classes and event handlers as has probably been my biggest issue facing this assignment.
Anyways this is what I have so far and thanks in advance for any help.

Robot.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Threading.Tasks;

namespace Robot
{

    public enum Direction {North,East,South,West }

    public delegate void RangeLimitEventHandler(object source, RangeLimitArgs re);

    public class RangeLimitArgs { }



   public class robot
    {
        private int range;
        public Direction orientation;

        public Direction direction;
        public robot() 
        {
            location = new Point();           
            direction = Direction.North;
        }

        public Point location { get; set; }
        public void Move(int unitToMove)
        {
            Point P = new Point();
            switch (direction)
            {
                case Direction.North:
                    P.X = location.X;
                    P.Y = location.Y - unitToMove;
                    break;
                case Direction.West:
                    P.X = location.X - unitToMove;
                    P.Y = location.Y;
                    break;
                case Direction.South:
                    P.X = location.X;
                    P.Y = location.Y + unitToMove;
                    break;
                case Direction.East:
                    P.X = location.X + unitToMove;
                    P.Y = location.Y;
                    break;
                default:
                    break;
            }
            location = P;
        }

        public void Draw(Graphics G)
        {

            SolidBrush redBrush = new SolidBrush(Color.Red);
            Size S = new Size(40, 40);
            Rectangle R = new Rectangle(location, S);

            G.FillEllipse(redBrush, R);
        }

        public override string ToString()
        {

            return ((char)direction).ToString();
        }
    }
}

form.cs

using Robot;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Robot5

{
    public enum Arrow { Up = 233, Right = 232, Down =234, Left = 231}
    public partial class Form1 : Form
    {
        private Robot robot;
        private Point center;
        public Form1()
        {
            InitializeComponent();
        }
       //private void DirectionButton_Click(object sender,EventArgs e)

        private void HandelRangeExceeded(object sender, ArgumentOutOfRangeException re)
        {
            MessageBox.Show("The robot tried to move too far" + re.GetInfo()));

        }

        private void btnNorth_Click(object sender, EventArgs e)
        {

        }

        private void btnEast_Click(object sender, EventArgs e)
        {

        }

        private void btnSouth_Click(object sender, EventArgs e)
        {

        }

        private void btnWest_Click(object sender, EventArgs e)
        {

        }

        private void btnGo1_Click(object sender, EventArgs e)
        {

        }

        private void btnGo10_Click(object sender, EventArgs e)
        {

        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.