Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 8th, 2007, 08:57 PM
Authorized User
 
Join Date: Feb 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pixel lenght of a string

How can I figure out how long a string is in pixels? For example, how can I get how many pixels wide the string "256" in size 12 "Verdana".

I already googled this, and could not find any code. Any ideas would be appreciated.

There are 10 types of people - Those who understand binary, and those who don't.
http://bschleusner.googlepages.com/home
__________________
There are 10 types of people - Those who understand binary, and those who don\'t.
http://bschleusner.googlepages.com/home
 
Old May 9th, 2007, 01:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at MeasureString: http://msdn2.microsoft.com/en-us/lib...urestring.aspx

ope this helps,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old May 9th, 2007, 07:35 AM
Authorized User
 
Join Date: Feb 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, that is exactly what I needed!

There are 10 types of people - Those who understand binary, and those who don't.
http://bschleusner.googlepages.com/home





Similar Threads
Thread Thread Starter Forum Replies Last Post
pixel colour shanthi85 Beginning VB 6 0 May 22nd, 2007 11:23 AM
number pixel Perseus Beginning VB 6 1 August 11th, 2005 05:08 PM
Query Regarding the pixel CsharpHelp C# 0 May 16th, 2005 11:12 PM
pixel coordinates david.iulian Classic ASP Basics 0 March 31st, 2005 07:03 AM
Help with finishing coding on text lenght... Brettvan1 VB.NET 2002/2003 Basics 9 December 3rd, 2004 02:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.