title: C# Making progress bar
body: <p>Ok im in a bit of a pickle, I am making a game, and i have experience in it. </p>
  
  <p>Now for the player to level up it needs to have a curtain xp.</p>
  
  <p>So Player has 20xp and he needs 40xp, I want the progress bar to show, 50% full.</p>
  
  <p>Cant figure that out, and also the progress bar is 260px wide and i need it to when its 50% full, have the width of the progress bar to be 130px long, and at 100% complete i need it to be 260px wide? </p>
  
  <p>Hope i gave enough info i am making a label expand to a curtain width (260%) to be my progress bar.</p>
  
  <p>EDIT: </p>
  
  <p>Using PictureBox to get 10xp every click to test the bar.</p>
  
  <pre><code>private void pictureBox2_Click(object sender, EventArgs e)
      {
          GetXP();
      }
  
  private void GetXP()
      {
          int XpBarWidth = 260;
          int PlayerXP = Convert.ToInt32(Exp.Text);
          int NeededXP = xp_needed;
  
          label1.Text = PlayerXP.ToString();
          label4.Text = NeededXP.ToString();
  
          int Ratio = (PlayerXP / NeededXP);
  
          XpBar.Width = (int)(XpBarWidth * Ratio);
          XpBar.Refresh();
      }
  </code></pre>
  
  <p>Label1 and Label4 where to test the PlayerXP and the NeededXP ints.</p>