[API]
RECT
GetSysColor
SetBkColor
SetTextColor
FillRect


[INCLUDE]
DrawText

[CODE]
Public Sub DrawProgressBarEx(ByVal hDC As Long, ByRef xType1 As RECT, ByVal Progress As Single, ByVal xText As String)
  Dim xFillPos As Long
  Dim TextWidth As Long
  'Dim TextHeight As Long
  Dim xType2 As RECT ' filling / temp
  Dim xType3 As RECT ' text / temp
  
  xType2 = xType1
  xFillPos = (xType1.Right - xType1.Left) * Progress + xType1.Left '+ 1&
  xType2.Right = xFillPos '+ 1&
  xType3 = xType1
  Call DrawText(hdc, xText, xType3, &HC20&)
  xType3.Top = (xType1.Bottom - (xType3.Bottom - xType3.Top)) / 2&
  xType3.Bottom = xType3.Top + xType3.Bottom
  TextWidth = xType3.Right - xType3.Left
  xType3.Left = (xType1.Right - TextWidth) / 2&
  xType3.Right = xType1.Right
  If xType3.Left < 0& Then xType3.Left = 0&
  If xType3.Top < 0& Then xType3.Top = 0&
  If xType3.Right > xType1.Right Then xType3.Right = xType1.Right
  If xType3.Bottom > xType1.Bottom Then xType3.Bottom = xType1.Bottom
  
  Call SetBkColor(hdc, GetSysColor(15&))
  Call SetTextColor(hdc, GetSysColor(18&))
  Call FillRect(hdc, xType2, 14&)
  xType2.Left = xType2.Right
  xType2.Right = xType1.Right
  Call FillRect(hdc, xType2, 16&)
  
  Call DrawText(hdc, xText, xType3, &H820&)
  Call SetBkColor(hdc, GetSysColor(13&))
  Call SetTextColor(hdc, GetSysColor(14&))
  xType3.Right = xFillPos
  Call DrawText(hdc, xText, xType3, &H820&)
  End Sub





