title: C# bouncing ball angle changing
body: <p>I am making a Windows Form program in C# where an image bounces around in the window at 45 degree angles. The part where I need help in is that I must make the program so then the user can adjust the angle that the image bounces, between 0 and 90 degrees. I cannot think of a simple way to do this and I really need help.</p>
  
  <p>This is the timer code that I have so far. <code>intSideposition</code> is the left value of the image. <code>intTopPosition</code> is the top value of the image. <code>intLeftSpeed</code> is the horizontal speed of the image. <code>intTopSpeed</code> is the vertical speed of the image. 817 and 380 are the borders of the window that the image will bounce off of. Currently the image will bounce at a 45 degree angle.</p>
  
  <pre><code>//Moves the label by a factor of whatever intLeftSpeed is
  intSidePosition = intSidePosition + intLeftSpeed;
  intTopPosition = intTopPosition + intTopSpeed;
  this.lblSprite.Left = intSidePosition;
  this.lblSprite.Top = intTopPosition;
  
  //Checks if the sprite has hit the boundaries of the window, causing it to bounce
  if (this.lblSprite.Left &lt;= 0)
  {
      intLeftSpeed = intLeftSpeed * -1;
  }
  else if (this.lblSprite.Left &gt;= 817)
  {
      intLeftSpeed = intLeftSpeed * -1;
  }
  else if (this.lblSprite.Top &gt;= 380)
  {
      intTopSpeed = intTopSpeed * -1;
  }
  else if (this.lblSprite.Top &lt;= 0)
  {
      intTopSpeed = intTopSpeed * -1;
  }
  lblAngle.Text = intAngle.ToString();
  </code></pre>