by Vishal V. Kulkarni (6 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 4th September 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This code gives the length of alphabets and numbers in pixels.As you might need while alignment in reports or during producing txt
API Declarations
'Purpose : This code gives the length of alphabets and numbers in
' pixels.As you might need while alignment in reports or
' during producing txt files.
' Remember length of w = 8 pixels
' length of W = 11 pixels
' But w or W as has a length of 1 character as len(w)=len(W)=1
'This code needs a textbox text1 as default to get input of the desired
'character and text2 for viewing length in pixels
'Please do not hesitate to contact the author for such problems.
'Forward your querries to [email protected]
Private Type Size
cx As Integer
cy As Integer
End Type
Private Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (ByVal hdc As Long, ByVal lpsz As String, ByVal cbString As Long, lpsize As Size) As Long
Dim lpsize As Size
Dim l As Long
Dim s As String
l = GetTextExtentPoint32(Form1.hdc, Text1.Text, Len(Text1.Text), lpsize)
Text2.Text = lpsize.cx & "-----" & Text1.Text
End Sub
No comments have been posted about This code gives the length of alphabets and numbers in pixels.As you might need while alignment in . Why not be the first to post a comment about This code gives the length of alphabets and numbers in pixels.As you might need while alignment in .