Harro. I am trying to draw some text on a picture box using the DrawText API. For Some Reason it does not work, It doesnt draw anything at all. Maybe someone can fill me in.

I am also using the SetRect API to draw the rect to draw the text in.

VB Code:
  1. 'In Module
  2. Public Declare Function DrawText Lib "user32" Alias "DrawTextA" _
  3.                        (ByVal hdc As Long, _
  4.                         ByVal lpStr As String, ByVal nCount As Long, _
  5.                         lpRect As RECT, _
  6.                         ByVal wFormat As Long) As Long
  7.  
  8. Public Declare Function SetRect Lib "user32" _
  9.                        (lpRect As RECT, _
  10.                         ByVal X1 As Long, ByVal Y1 As Long, _
  11.                         ByVal X2 As Long, ByVal Y2 As Long) As Long
  12.  
  13.  
  14. Public Type RECT
  15.             Left As Long
  16.             Top As Long
  17.             Right As Long
  18.             Bottom As Long
  19. End Type
  20.  
  21. Public Const DT_CENTER = &H1
  22. Public Const DT_LEFT = &H0
  23. Public Const DT_RIGHT = &H2
  24. Public Const DT_VCENTER = &H4
  25. Public Const DT_WORDBREAK = &H10
  26. Public Const DT_SINGLELINE = &H20
  27.  
  28. 'In General Section of Form
  29. Dim ItemRct As RECT
  30.  
  31. 'In a command Button
  32.  
  33. SetRect ItemRct, 0, Picture1.TextHeight("Aa"), ItemRct.Right, Picture1.TextHeight("Aa") + Picture1.TextHeight("Aa")
  34.  
  35. DrawText Picture1.hdc, Text1.Text, Len(Text1), ItemRct, DT_SINGLELINE Or DT_VCENTER

THANKS!