|
-
September 4th, 2001, 09:15 AM
#1
textbox
I would like to know a text width 1000pcx = how many character?
thank you
-
September 4th, 2001, 09:35 AM
#2
Re: textbox
In most fonts, you cannot determin how many characters can fit in a specific length. You can only get the width of a text, not the characters that would fit a width.
On the other hand, some fonts (monotype fonts), have a fixed width for every character. In this case, you could determine it.
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
September 4th, 2001, 11:06 AM
#3
Re: textbox
maybe
Private Declare Function GetWindowTextLength Lib "user32"
Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
can help you...
from api-guide:
The GetWindowTextLength function retrieves the length, in characters, of the
specified window’s title bar text (if the window has a title bar). If the
specified window is a control, the function retrieves the length of the text
within the control
private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (byval hwnd as Long, byval lpString as string, byval cch as Long) as Long
private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (byval hwnd as Long) as Long
private Sub Form_Activate()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim MyStr as string
'Create a buffer
MyStr = string(GetWindowTextLength(me.hwnd) + 1, Chr$(0))
'get the window's text
GetWindowText me.hwnd, MyStr, len(MyStr)
MsgBox MyStr
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
September 4th, 2001, 11:08 AM
#4
Re: textbox
Or maybe better:
(api-guide)
The GetTextExtentPoint32 function computes the width and height of the
specified string of text. This function supersedes the GetTextExtentPoint
function
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|