예제 #1
0
파일: Main.cs 프로젝트: giangrg/RoboSim
        private void btnPlace_Click(object sender, EventArgs e)
        {
            try {
            int xPos = 0, yPos = 0;

            // Get the values from the textboxes
            xPos = Convert.ToInt32(txtX.Text) * magnitude;
            yPos = Convert.ToInt32(txtY.Text) * magnitude;

            // Place a robot on the table
            RoboPlayer = new Robot(AppResource.Robot, (Direction)cmbF.SelectedIndex);
            RoboPlayer.Coordinate = new Point(xPos, yPos);

            // Activate controls
            EnableControls();

            pnlTable.Refresh();
             }
             catch (Exception) {
            MessageBox.Show("Error: Invalid X or Y value.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
        }
예제 #2
0
 public void SetUp()
 {
     TestImg = new Bitmap(100, 100);
      TestRobo = new Robot(TestImg);
      TestRobo.Coordinate = new Point(200, 200);
 }