vb.net - MeasureText() - SizeF to inches -


i guess don't know search terms use, should simple... determine width in inches of string.

        dim ssize system.drawing.sizef         dim ffont new font("arial", 12)         ssize = me.creategraphics().measurestring(txtaddr.text, ffont) 

the units here whatever ide using. i'm not sure constant value, if conversion should straightforward.

any way, want convert returned units inches when text printed @ 100% using specified font. how do that?


thanks hans!

        dim boxgraphics graphics = txtaddr.creategraphics()         dim ssize system.drawing.sizef = boxgraphics.measurestring(txtaddr.text, new font("arial", 12))         dim iinches single = ssize.width / boxgraphics.dpix 

beginnings of dymo labelwriter 450 code might interested:

        ' project ref dymo.label.framework .net 3.5/4         ' imports dymo.label.framework         dim olabel label         olabel = label.open("h:\info\forms\admin\dymo labels\apcdaddress.label")         olabel.setobjecttext("address", txtaddr.text) ' case sensitive         olabel.print("\\pc3090-117\dymo labelwriter 450 twin turbo")         msgbox("printed") 

i'll adding code deal address text maybe large label, hence op. dymo layouts can set shrink fit text has practical limits when making address labels.

from @hanspassant: divide graphics.dpix

   dim boxgraphics graphics = txtaddr.creategraphics()     dim ssize system.drawing.sizef = boxgraphics.measurestring(txtaddr.text, new font("arial", 12))     dim iinches single = ssize.width / boxgraphics.dpix 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -