Question: Given a number of pixels (say: 300) and a Font (fixed type, fixed size, like Consolas), how could I determine the maximum number of characters that I could draw with **GDI+**?

The text won't be written to a Label or such, but drawn using GDI+:

```
public void DrawString( string s, Font font, Brush brush, 
    RectangleF layoutRectangle, StringFormat format );

```

But I want to perform certain text operations before drawing, hence why I'd like to figure out the maximum number of chars I can safely output.

Answer: 
There is also [TextRenderer.MeasureText()](http://msdn.microsoft.com/en-us/library/system.windows.forms.textrenderer.measuretext.aspx), which produces a different result (this is what is used when drawing windows controls, so it is generally more accurate). 

There is a discussion on SO somewhere about it, but I cannot find it at the moment.

**Edit:** [This MSDN Article](http://msdn.microsoft.com/en-gb/magazine/cc751527.aspx) goes a little more in depth.
You could use [Drawing.Graphics.MeasureString()](http://msdn.microsoft.com/en-us/library/system.drawing.graphics.measurestring.aspx) to get the size of one of your glyphs.  

Then just check how many of them fit into your drawing area.