title: Progress bar change colour
body: <p>im trying to change the colour of the progress bar for a custom control. ive tryed quite a few methords like using the sendingmessage function below:</p>
  
  <blockquote>
  <pre><code>&lt;DllImport("User32.Dll")&gt; _
  Public Shared Function SendMessage(hwnd As Integer, wMsg As Integer, wParam As Integer, lParam As Integer) As Integer
  End Function
  </code></pre>
  </blockquote>
  
  <pre><code>Public Const PBM_SETBKCOLOR As Integer = &amp;H2001
  Public Const PBM_SETBARCOLOR As Integer = &amp;H409
  
  Public Sub SetProgressBackColor(c As Color)
  
      Dim a As Integer = Convert.ToInt32(c.R.ToString())
      Dim b As Integer = Convert.ToInt32(c.G.ToString())
      Dim d As Integer = Convert.ToInt32(c.B.ToString())
      Dim tot As Integer = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString())
      Dim j As Integer = Me.PercentFull.Handle.ToInt32()
      SendMessage(j, PBM_SETBKCOLOR, 0, tot)
  End Sub
  
  Public Sub SetProgressForeColor(c As Color)
  
      Dim a As Integer = Convert.ToInt32(c.R.ToString())
      Dim b As Integer = Convert.ToInt32(c.G.ToString())
      Dim d As Integer = Convert.ToInt32(c.B.ToString())
      Dim tot As Integer = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString())
      Dim j As Integer = Me.PercentFull.Handle.ToInt32()
      SendMessage(j, PBM_SETBARCOLOR, 0, tot)
  End Sub
  </code></pre>
  
  <p>but this didnt work for me i couldent see any change.</p>
  
  <p>what would be the best way for me to change the forecolor for this control? i cannot use PercentFull.ForeColor as i will have xp styles enabled.</p>
  
  <p>Thanks</p>