How can I know the width of a string for a specific fontsize, fonttype etc?
Printable View
How can I know the width of a string for a specific fontsize, fonttype etc?
using the printer object if you set the font and then use the printer.textwidth method... that should do it for yaQuote:
Originally posted by krtxmrtz
How can I know the width of a string for a specific fontsize, fonttype etc?
Picture boxes also support .TextWidth.
Probably even the Form.
yeah form does as well.. i suggested the printer object because it is built in and you can change the font without it affecting your form or anything... but if you can use form i would recommend that... as i found out the hard way.. calls to the printer object will fail if windows doens't have a printer installed :(Quote:
Originally posted by DiGiTaIErRoR
Picture boxes also support .TextWidth.
Probably even the Form.
I don't really get what you mean.
But i know how to make a label/textbox roughy the same lenght as the text.
First, fontname is fixedsys.
then:
info.width = Len(info2.Caption) * 125
I learn this while creating WWP
set the font first for info and info2 then
VB Code:
info.width = TextWidth(Info2.Caption)