Hey, my solution may have been crude and low-tech, but it would work just as well, and a VB component isn't an option for some classic ASP developers who don't have access to Visual Studio. For a non-VB-programmer, it would take a LOT longer to figure out how to create a VB component, or even find another programmer to do it and finish it, than it would to measure characters in a screen capture. Sometimes crude and low-tech saves a lot of time and money and provides the same results.
But, since you're comfortable going with a VB component as a solution, then that's what I would do. :-) ...actually I'd do it in .NET. Well, glad I could provide a little laughter this morning. You gotta admit--THAT'S thinking outside the box! :-) - JV > -----Original Message----- > From: Niels Bieze [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 29, 2004 9:12 AM > To: [EMAIL PROTECTED] > Subject: RE: [ASP] Calculating the length of a string in pixels > > ROFL > > Im seriously considering your first option > > After a long day of searching, im going with a VB solution, > system.drawing.graphics.measurestring() this will return the > width and height on a specified string > > "give complete solutions, they help others" department: > -On the www this would be pretty moch useless as John stated, > because browsers, installed fonts etc are different & every > browser allows you to fixate your font. but im on a intranet > :P -as far as I know there is no component that will do this... > > Thanks to all! (specially you john, my colleagues are still > wondering why I was on the floor) > > > -----Oorspronkelijk bericht----- > Van: John Vieth [mailto:[EMAIL PROTECTED] > Verzonden: woensdag 29 september 2004 15:36 > Aan: [EMAIL PROTECTED] > Onderwerp: RE: [ASP] Calculating the length of a string in pixels > > Here's a poor man's (or simple man's) solution... > > First display in a web page every character (numbers, > letters, upper case, lower case, etc) that might appear in > your app. Display the characters using the exact same type > properties, including font family, size, weight, etc. Make a > screen capture of the page that displays these characters. > Paste the screen capture into a Photoshop image and zoom in > on each character so that you can measure its width in pixels. > On paper or a text document, record the width in pixels that > corresponds with each character. Once you've gathered all > the data, create a VBScript function for your ASP pages that > computes the width of a string. The first thing the function > must do is build a 2-dimensional array to contain all the > pairs of data--character and width. Then the function should > parse through the string one character at a time, look up > each character in the array to find its width, and add the > width to an integer that represents the total width of the > string. The function would then return the integer. > > > > ------------------------ Yahoo! Groups Sponsor > --------------------~--> > $9.95 domain names from Yahoo!. Register anything. > http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/17folB/TM > -------------------------------------------------------------- > ------~-> > > -------------------------------------------------------------- > ------- > Home : http://groups.yahoo.com/group/active-server-pages > --------------------------------------------------------------------- > Post : [EMAIL PROTECTED] > Subscribe : [EMAIL PROTECTED] > Unsubscribe: [EMAIL PROTECTED] > --------------------------------------------------------------------- > Yahoo! Groups Links > > > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM --------------------------------------------------------------------~-> --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [EMAIL PROTECTED] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
