Hi there,
Your question *was* difficult to understand. Since you didn't specify your target application, it was hard to guess what you wanted. By default, a Web "label" will adjust its size to display all 4,000 characters automatically.
Anyway, if you want to measure the size of a String look into the MeasureString method. The following code will tell you how large String to Measure will be:
Code:
string measureString = "String to Measure";
Font stringFont = new Font("Arial", 12);
Bitmap myBitmap = new Bitmap(100, 100);
SizeF stringSize = new SizeF();
Graphics myGrahpics = Graphics.FromImage(myBitmap);
stringSize = myGrahpics.MeasureString(measureString, stringFont);
You'll need the System.Drawing namespace for this work.
The SizeF struct, stringSize, exposes a Height and a Width property of your string in Pixels as a float, so you may need to do some rounding.
I haven't found a way yet to do this without creating the intermediate Bitmap object, but there may be ways around it.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Was Besonderes by
Guano Apes (Track 3 from the album:
Proud Like a God)
What's This?