2012-02-29 18 views
8

Esta es la salida que obtengo cuando uso DrawString.Ajustar palabra de cordón o mostrar el texto completo

I = Smith, Juan II = Johnson, Mark III = Anderson, James IV = William, Craig V = Ford, Él ...

página es un tipo de datos flotador que se basa el valor en e.PageSettings.Margins.Left;

e.Graphics.DrawString (Texto, nuevo System.Drawing.Font ("Arial", 8F, FontStyle.Regular), Brushes.Black, página, 30);

En el ejemplo anterior, es

e.Graphics.DrawString(Text, new System.Drawing.Font("Arial", 8F, FontStyle.Regular), Brushes.Black, page, 30); 

He intentado utilizar esta

StringFormat format = new StringFormat();    
format.FormatFlags = StringFormatFlags.FitBlackBox; 

e.Graphics.DrawString(Text, new System.Drawing.Font("Arial", 8F, FontStyle.Regular), Brushes.Black, page, 30, format); 

¿Cómo amplío/ajuste de línea para que pueda tener la totalidad de las palabras en lugar de' ... ' ¿al final?

I = Smith, Juan II = Johnson, Mark III = Anderson, James IV = William, Craig V = Ford, Henry

Respuesta

17

Puede "Ajuste de línea" el texto utilizando un delimitador rectángulo.

Uso Graphics.DrawString Method (String, Font, Brush, RectangleF, StringFormat)

El RectangleF especifica la zona de dibujo y automáticamente "envolver" el texto para usted.

+0

Utilicé el ejemplo anterior, todavía obtengo '...' al final. – Sharpeye500

+0

¿Cuáles son los límites de su rectángulo de dibujo? – Sorean

+0

Rectángulo rect = new Rectangle (100, 80, 800, 20); – Sharpeye500

Cuestiones relacionadas