473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MeasureString

Why does this code

Console.WriteLine(g.MeasureString("a", new Font("Lucida Console",
11f)).Width);
Console.WriteLine(g.MeasureString("aa", new Font("Lucida Console",
11f)).Width);

produce this output:

13.9911
23.09331

Shouldn't the 2nd number be twice as large as the first?
Nov 13 '05 #1
0 2522

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jesse Wade | last post by:
I'm trying to create a function that will pad a string with spaces so that the resulting string is a specific width (in this case 50points). As expected, the following code when passed an empty...
1
by: Yaron | last post by:
Hi, I made a procedure which receives a Graphics parameter, and with that Graphics parameter, performs various things. The area of confusion here is that when I pass the procedure a Graphics...
2
by: Stuart Norris | last post by:
Dear Group, I have a question about the result from ‘graphics.MeasureString' when using a mono-spaced font. Firstly I assume that Courier New font is mono-spaced, ie each character takes up the...
0
by: keith | last post by:
I did a test typing characters until fill out whole textbox (single line). Then I chcked width of this string in paint event e.Graphics.MeasureString(textBox1.Text,textBox1.Font).Width e.g....
0
by: Meetali Goel | last post by:
Hi all, I can't determine why I keep getting "NotSupportedException" when g.MeasureString() is called in the following code (.NET CE). I have spent several hours but I cant seem to find the...
5
by: Marc | last post by:
I want to use Measurestring in a Class. In a form I write cInt(Me.CreateGraphics.Measurestring("Text", mFont).Width) What do I write in a class (I dont't have the Me.CreateGraphics there...) ...
7
by: teo | last post by:
Hallo, I'd like to retrieve the pixel length of a string. ------------------------ I decided to use MeasureString, but I have a problem with the graphic "instance" of it. I'm in a Sub and
2
by: teo | last post by:
I have to measure the length of a string in a Label, to set the adequate Label width (because not all browsers support the auto-size Label property). I decide to use the 'MeasureString'...
6
by: Rainer Queck | last post by:
Hello NG, I am trying to adjust the column width of a DataGridView to the Text in its column header. To do this I am using the Graphics.MeasureString method. Unfortunatly I alway get a too...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.