--- In nsbasic...@yahoogroups.com, "slateware" <jlsl...@...> wrote:
>
> --- In nsbasic...@yahoogroups.com, "andyx77" <sng.alloy@> wrote:
> >
> > Hi
> > 
> > Does anyone know if it's possible to determine the width of a text string 
> > at a given font size (similar to VB's TextWidth function)?
> > 
> > Andrew
> >
> 
> I have not been following all of this conversation, so maybe something like 
> this has been suggested already, or doesn't meet your requirements, or I have 
> totally missed the question, but here it is my possible solution:
> 
> option explicit
> dim txt
> txt="This is a test"
> addobject "picturebox", "pb" 0,0,200,200 '0,0,0,0 to not display
> dim i
> for i=7 to 10
> pb.fontsize=i
> pb.drawtext i & "-" & pb.textwidth(txt) & "-" & txt
> next
> pb.fontbold=true
> for i=7 to 10
> pb.fontsize=i
> pb.drawtext i & "-" & pb.textwidth(txt) & "-" & txt
> next
> 
> Jim
>

I have only just got back onto this project.

Many thanks, Jim, and to everyone else who made suggestions.

Jim's solution looks to be the way forward for me. I should be able to get a 
"good enough" calculation of my text width using the picturebox object.

I struggled with the gettextextentpoint function. I'm sure there is some 
combination of correct declaration and function call that will work, but admit 
that it escapes me!

Thanks again, everyone


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nsb-ce" group.
To post to this group, send email to nsb-ce@googlegroups.com
To unsubscribe from this group, send email to 
nsb-ce+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to