Wednesday, April 29, 2009

Tab Text

'Tab Text

Private Declare Function TabbedTextOut
Lib "user32" Alias _

"TabbedTextOutA" (ByVal hdc
As Long, ByVal x
As Long, _

ByVal y As Long,
ByVal lpString As String,
ByVal nCount As Long, _

ByVal nTabPositions As Long, lpnTabStopPositions
As Long, _

ByVal nTabOrigin As Long)
As Long



Private Sub Form_Paint()

Dim TbSP(0 To 2) As Long, TbO(0
To 2) As Long

Dim mStr As String



'set the form's scalemode to Pixels

Me.ScaleMode = vbPixels



'Set the tabstops

TbSP(0) = 100

TbSP(1) = 200

TbSP(2) = 300

TbO(0) = 0

TbO(1) = 100

TbO(2) = 200



'print first string

mStr = "Rockess" + Chr$(9) + "Alpha" + Chr$(9) + "!"

TabbedTextOut Me.hdc, 0, 0, mStr, Len(mStr), 3, TbSP(0), TbO(0)



'print second string

mStr = "Visit" + Chr$(9) + "My" + Chr$(9) + "Blog"

TabbedTextOut Me.hdc, 0, Me.TextHeight(mStr), mStr, Len(mStr), 3, _

TbSP(0), TbO(0)

End Sub



 

No comments:

Post a Comment