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:
'In Module Public Declare Function DrawText Lib "user32" Alias "DrawTextA" _ (ByVal hdc As Long, _ ByVal lpStr As String, ByVal nCount As Long, _ lpRect As RECT, _ ByVal wFormat As Long) As Long Public Declare Function SetRect Lib "user32" _ (lpRect As RECT, _ ByVal X1 As Long, ByVal Y1 As Long, _ ByVal X2 As Long, ByVal Y2 As Long) As Long Public Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Public Const DT_CENTER = &H1 Public Const DT_LEFT = &H0 Public Const DT_RIGHT = &H2 Public Const DT_VCENTER = &H4 Public Const DT_WORDBREAK = &H10 Public Const DT_SINGLELINE = &H20 'In General Section of Form Dim ItemRct As RECT 'In a command Button SetRect ItemRct, 0, Picture1.TextHeight("Aa"), ItemRct.Right, Picture1.TextHeight("Aa") + Picture1.TextHeight("Aa") DrawText Picture1.hdc, Text1.Text, Len(Text1), ItemRct, DT_SINGLELINE Or DT_VCENTER
THANKS!
![]()
![]()
![]()
![]()
![]()
![]()





Reply With Quote