Re: string resizing
From: Russ (russk2_at_eticomm.net)
Date: 06/22/04
- Next message: Brian Korzeniowski: "RE: Attaching CSS classes to web controls"
- Previous message: Eliyahu Goldin: "Re: Stop a button posting back"
- In reply to: Matt MacDonald: "string resizing"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 22 Jun 2004 11:21:51 -0400
It's not so easy. First you have to know what font is being used in
the browser. Then you need a table of character widths in pixels.
Finally you need to write a routine to index into the table and add up
all the widths for each character you want to display. You need to
know any scaling factor that has been applied to the font so you can
also apply it to your calculation.
I do this in order to center strings in a form when printing to a HP
printer and it works fine. But when you are dealing with unknowns
like "what browser and what font and what size?", it becomes a lot
more difficult. Perhaps there is a way to know the above information
- someone else will have to tell you about that.
HTH, Russ
On Mon, 21 Jun 2004 17:19:18 -0400, "Matt MacDonald"
<mattsmac@hotmail.com> wrote:
>Here's a pretty easy one i think.
>
>How do I trim a string to a certain (physical) length i.e. in pixels, as
>opposed to characters?
>
>I'm tring to fit strings in data cells in an asp datagrid.
>
>Thanks alot,
>Matt
>
- Next message: Brian Korzeniowski: "RE: Attaching CSS classes to web controls"
- Previous message: Eliyahu Goldin: "Re: Stop a button posting back"
- In reply to: Matt MacDonald: "string resizing"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|