TextRenderer.MeasureText Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Mide el texto especificado cuando se dibuja con la fuente especificada.
Sobrecargas
| Nombre | Description |
|---|---|
| MeasureText(String, Font) |
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con la fuente especificada. |
| MeasureText(IDeviceContext, String, Font) |
Proporciona el tamaño, en píxeles, del texto especificado dibujado con la fuente especificada en el contexto de dispositivo especificado. |
| MeasureText(String, Font, Size) |
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con la fuente especificada, utilizando el tamaño especificado para crear un rectángulo delimitador inicial. |
| MeasureText(IDeviceContext, String, Font, Size) |
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con la fuente especificada en el contexto de dispositivo especificado, utilizando el tamaño especificado para crear un rectángulo delimitador inicial para el texto. |
| MeasureText(String, Font, Size, TextFormatFlags) |
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con la fuente y las instrucciones de formato especificadas, utilizando el tamaño especificado para crear el rectángulo de límite inicial para el texto. |
| MeasureText(IDeviceContext, String, Font, Size, TextFormatFlags) |
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con el contexto de dispositivo, la fuente y las instrucciones de formato especificados, utilizando el tamaño especificado para crear el rectángulo de límite inicial para el texto. |
MeasureText(String, Font)
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con la fuente especificada.
public:
static System::Drawing::Size MeasureText(System::String ^ text, System::Drawing::Font ^ font);
public static System.Drawing.Size MeasureText(string text, System.Drawing.Font font);
static member MeasureText : string * System.Drawing.Font -> System.Drawing.Size
Public Shared Function MeasureText (text As String, font As Font) As Size
Parámetros
- text
- String
Texto que se va a medir.
Devoluciones
, Sizeen píxeles, de text dibujado en una sola línea con el especificado font. Puede manipular cómo se dibuja el texto mediante una de las DrawText(IDeviceContext, String, Font, Rectangle, Color, TextFormatFlags) sobrecargas que toma un TextFormatFlags parámetro. Por ejemplo, el comportamiento predeterminado de TextRenderer es agregar relleno al rectángulo delimitador del texto dibujado para dar cabida a glifos de sobresalido. Si necesita dibujar una línea de texto sin estos espacios adicionales, debe usar las versiones de DrawText(IDeviceContext, String, Font, Point, Color) y MeasureText(IDeviceContext, String, Font) que toman un Size parámetro y TextFormatFlags . Para obtener un ejemplo, consulte MeasureText(IDeviceContext, String, Font, Size, TextFormatFlags).
Ejemplos
En el ejemplo de código siguiente se muestra cómo usar el MeasureText método . Para ejecutar este ejemplo, pegue el código en un formulario Windows y llame a
private void MeasureText1(PaintEventArgs e)
{
String text1 = "Measure this text";
Font arialBold = new Font("Arial", 12.0F);
Size textSize = TextRenderer.MeasureText(text1, arialBold);
TextRenderer.DrawText(e.Graphics, text1, arialBold,
new Rectangle(new Point(10, 10), textSize), Color.Red);
}
Private Sub MeasureText1(ByVal e As PaintEventArgs)
Dim text1 As String = "Measure this text"
Dim arialBold As New Font("Arial", 12.0F)
Dim textSize As Size = TextRenderer.MeasureText(text1, arialBold)
TextRenderer.DrawText(e.Graphics, text1, arialBold, _
New Rectangle(New Point(10, 10), textSize), Color.Red)
End Sub
Comentarios
El MeasureText método requiere que el texto se dibuje en una sola línea.
Se aplica a
MeasureText(IDeviceContext, String, Font)
Proporciona el tamaño, en píxeles, del texto especificado dibujado con la fuente especificada en el contexto de dispositivo especificado.
public:
static System::Drawing::Size MeasureText(System::Drawing::IDeviceContext ^ dc, System::String ^ text, System::Drawing::Font ^ font);
public static System.Drawing.Size MeasureText(System.Drawing.IDeviceContext dc, string text, System.Drawing.Font font);
static member MeasureText : System.Drawing.IDeviceContext * string * System.Drawing.Font -> System.Drawing.Size
Public Shared Function MeasureText (dc As IDeviceContext, text As String, font As Font) As Size
Parámetros
Contexto del dispositivo en el que se va a medir el texto.
- text
- String
Texto que se va a medir.
Devoluciones
, Sizeen píxeles, de text dibujado en una sola línea con el especificado font en el contexto de dispositivo especificado.
Ejemplos
En el ejemplo de código siguiente se muestra cómo usar uno de los MeasureText métodos . Para ejecutar este ejemplo, pegue el código en un formulario Windows y llame a
private static void DrawALineOfText(PaintEventArgs e)
{
// Declare strings to render on the form.
string[] stringsToPaint = { "Tail", "Spin", " Toys" };
// Declare fonts for rendering the strings.
Font[] fonts = { new Font("Arial", 14, FontStyle.Regular),
new Font("Arial", 14, FontStyle.Italic),
new Font("Arial", 14, FontStyle.Regular) };
Point startPoint = new Point(10, 10);
// Set TextFormatFlags to no padding so strings are drawn together.
TextFormatFlags flags = TextFormatFlags.NoPadding;
// Declare a proposed size with dimensions set to the maximum integer value.
Size proposedSize = new Size(int.MaxValue, int.MaxValue);
// Measure each string with its font and NoPadding value and
// draw it to the form.
for (int i = 0; i < stringsToPaint.Length; i++)
{
Size size = TextRenderer.MeasureText(e.Graphics, stringsToPaint[i],
fonts[i], proposedSize, flags);
Rectangle rect = new Rectangle(startPoint, size);
TextRenderer.DrawText(e.Graphics, stringsToPaint[i], fonts[i],
startPoint, Color.Black, flags);
startPoint.X += size.Width;
}
}
Private Sub DrawALineOfText(ByVal e As PaintEventArgs)
' Declare strings to render on the form.
Dim stringsToPaint() As String = {"Tail", "Spin", " Toys"}
' Declare fonts for rendering the strings.
Dim fonts() As Font = {New Font("Arial", 14, FontStyle.Regular), _
New Font("Arial", 14, FontStyle.Italic), _
New Font("Arial", 14, FontStyle.Regular)}
Dim startPoint As New Point(10, 10)
' Set TextFormatFlags to no padding so strings are drawn together.
Dim flags As TextFormatFlags = TextFormatFlags.NoPadding
' Declare a proposed size with dimensions set to the maximum integer value.
Dim proposedSize As Size = New Size(Integer.MaxValue, Integer.MaxValue)
' Measure each string with its font and NoPadding value and draw it to the form.
For i As Integer = 0 To stringsToPaint.Length - 1
Dim size As Size = TextRenderer.MeasureText(e.Graphics, _
stringsToPaint(i), fonts(i), proposedSize, flags)
Dim rect As Rectangle = New Rectangle(startPoint, size)
TextRenderer.DrawText(e.Graphics, stringsToPaint(i), fonts(i), _
startPoint, Color.Black, flags)
startPoint.X += size.Width
Next
End Sub
Comentarios
El MeasureText método requiere que el texto se dibuje en una sola línea.
Se aplica a
MeasureText(String, Font, Size)
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con la fuente especificada, utilizando el tamaño especificado para crear un rectángulo delimitador inicial.
public:
static System::Drawing::Size MeasureText(System::String ^ text, System::Drawing::Font ^ font, System::Drawing::Size proposedSize);
public static System.Drawing.Size MeasureText(string text, System.Drawing.Font font, System.Drawing.Size proposedSize);
static member MeasureText : string * System.Drawing.Font * System.Drawing.Size -> System.Drawing.Size
Public Shared Function MeasureText (text As String, font As Font, proposedSize As Size) As Size
Parámetros
- text
- String
Texto que se va a medir.
Devoluciones
, Sizeen píxeles, de text dibujado con el especificado font.
Ejemplos
En el ejemplo de código siguiente se muestra cómo usar uno de los MeasureText métodos . Para ejecutar este ejemplo, pegue el código en un formulario Windows y llame a
private static void DrawALineOfText(PaintEventArgs e)
{
// Declare strings to render on the form.
string[] stringsToPaint = { "Tail", "Spin", " Toys" };
// Declare fonts for rendering the strings.
Font[] fonts = { new Font("Arial", 14, FontStyle.Regular),
new Font("Arial", 14, FontStyle.Italic),
new Font("Arial", 14, FontStyle.Regular) };
Point startPoint = new Point(10, 10);
// Set TextFormatFlags to no padding so strings are drawn together.
TextFormatFlags flags = TextFormatFlags.NoPadding;
// Declare a proposed size with dimensions set to the maximum integer value.
Size proposedSize = new Size(int.MaxValue, int.MaxValue);
// Measure each string with its font and NoPadding value and
// draw it to the form.
for (int i = 0; i < stringsToPaint.Length; i++)
{
Size size = TextRenderer.MeasureText(e.Graphics, stringsToPaint[i],
fonts[i], proposedSize, flags);
Rectangle rect = new Rectangle(startPoint, size);
TextRenderer.DrawText(e.Graphics, stringsToPaint[i], fonts[i],
startPoint, Color.Black, flags);
startPoint.X += size.Width;
}
}
Private Sub DrawALineOfText(ByVal e As PaintEventArgs)
' Declare strings to render on the form.
Dim stringsToPaint() As String = {"Tail", "Spin", " Toys"}
' Declare fonts for rendering the strings.
Dim fonts() As Font = {New Font("Arial", 14, FontStyle.Regular), _
New Font("Arial", 14, FontStyle.Italic), _
New Font("Arial", 14, FontStyle.Regular)}
Dim startPoint As New Point(10, 10)
' Set TextFormatFlags to no padding so strings are drawn together.
Dim flags As TextFormatFlags = TextFormatFlags.NoPadding
' Declare a proposed size with dimensions set to the maximum integer value.
Dim proposedSize As Size = New Size(Integer.MaxValue, Integer.MaxValue)
' Measure each string with its font and NoPadding value and draw it to the form.
For i As Integer = 0 To stringsToPaint.Length - 1
Dim size As Size = TextRenderer.MeasureText(e.Graphics, _
stringsToPaint(i), fonts(i), proposedSize, flags)
Dim rect As Rectangle = New Rectangle(startPoint, size)
TextRenderer.DrawText(e.Graphics, stringsToPaint(i), fonts(i), _
startPoint, Color.Black, flags)
startPoint.X += size.Width
Next
End Sub
Comentarios
El MeasureText método usa el proposedSize parámetro para indicar la relación de alto al ancho al determinar el tamaño del texto. Al medir el texto en una sola línea, si el proposedSize parámetro representa un Size con una dimensión de alto mayor que Int32.MaxValue, el devuelto Size se ajustará para reflejar el alto real del texto.
Se aplica a
MeasureText(IDeviceContext, String, Font, Size)
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con la fuente especificada en el contexto de dispositivo especificado, utilizando el tamaño especificado para crear un rectángulo delimitador inicial para el texto.
public:
static System::Drawing::Size MeasureText(System::Drawing::IDeviceContext ^ dc, System::String ^ text, System::Drawing::Font ^ font, System::Drawing::Size proposedSize);
public static System.Drawing.Size MeasureText(System.Drawing.IDeviceContext dc, string text, System.Drawing.Font font, System.Drawing.Size proposedSize);
static member MeasureText : System.Drawing.IDeviceContext * string * System.Drawing.Font * System.Drawing.Size -> System.Drawing.Size
Public Shared Function MeasureText (dc As IDeviceContext, text As String, font As Font, proposedSize As Size) As Size
Parámetros
Contexto del dispositivo en el que se va a medir el texto.
- text
- String
Texto que se va a medir.
Devoluciones
, Sizeen píxeles, de text dibujado con el especificado font.
Excepciones
dc es null.
Ejemplos
En el ejemplo de código siguiente se muestra cómo usar uno de los MeasureText métodos . Para ejecutar este ejemplo, pegue el código en un formulario Windows y llame a
private static void DrawALineOfText(PaintEventArgs e)
{
// Declare strings to render on the form.
string[] stringsToPaint = { "Tail", "Spin", " Toys" };
// Declare fonts for rendering the strings.
Font[] fonts = { new Font("Arial", 14, FontStyle.Regular),
new Font("Arial", 14, FontStyle.Italic),
new Font("Arial", 14, FontStyle.Regular) };
Point startPoint = new Point(10, 10);
// Set TextFormatFlags to no padding so strings are drawn together.
TextFormatFlags flags = TextFormatFlags.NoPadding;
// Declare a proposed size with dimensions set to the maximum integer value.
Size proposedSize = new Size(int.MaxValue, int.MaxValue);
// Measure each string with its font and NoPadding value and
// draw it to the form.
for (int i = 0; i < stringsToPaint.Length; i++)
{
Size size = TextRenderer.MeasureText(e.Graphics, stringsToPaint[i],
fonts[i], proposedSize, flags);
Rectangle rect = new Rectangle(startPoint, size);
TextRenderer.DrawText(e.Graphics, stringsToPaint[i], fonts[i],
startPoint, Color.Black, flags);
startPoint.X += size.Width;
}
}
Private Sub DrawALineOfText(ByVal e As PaintEventArgs)
' Declare strings to render on the form.
Dim stringsToPaint() As String = {"Tail", "Spin", " Toys"}
' Declare fonts for rendering the strings.
Dim fonts() As Font = {New Font("Arial", 14, FontStyle.Regular), _
New Font("Arial", 14, FontStyle.Italic), _
New Font("Arial", 14, FontStyle.Regular)}
Dim startPoint As New Point(10, 10)
' Set TextFormatFlags to no padding so strings are drawn together.
Dim flags As TextFormatFlags = TextFormatFlags.NoPadding
' Declare a proposed size with dimensions set to the maximum integer value.
Dim proposedSize As Size = New Size(Integer.MaxValue, Integer.MaxValue)
' Measure each string with its font and NoPadding value and draw it to the form.
For i As Integer = 0 To stringsToPaint.Length - 1
Dim size As Size = TextRenderer.MeasureText(e.Graphics, _
stringsToPaint(i), fonts(i), proposedSize, flags)
Dim rect As Rectangle = New Rectangle(startPoint, size)
TextRenderer.DrawText(e.Graphics, stringsToPaint(i), fonts(i), _
startPoint, Color.Black, flags)
startPoint.X += size.Width
Next
End Sub
Comentarios
El MeasureText método usa el proposedSize parámetro para indicar la relación de alto al ancho al determinar el tamaño del texto. Al medir el texto en una sola línea, si el proposedSize parámetro representa un Size con una dimensión de alto mayor que Int32.MaxValue, el devuelto Size se ajustará para reflejar el alto real del texto.
Se aplica a
MeasureText(String, Font, Size, TextFormatFlags)
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con la fuente y las instrucciones de formato especificadas, utilizando el tamaño especificado para crear el rectángulo de límite inicial para el texto.
public:
static System::Drawing::Size MeasureText(System::String ^ text, System::Drawing::Font ^ font, System::Drawing::Size proposedSize, System::Windows::Forms::TextFormatFlags flags);
public static System.Drawing.Size MeasureText(string text, System.Drawing.Font font, System.Drawing.Size proposedSize, System.Windows.Forms.TextFormatFlags flags);
static member MeasureText : string * System.Drawing.Font * System.Drawing.Size * System.Windows.Forms.TextFormatFlags -> System.Drawing.Size
Public Shared Function MeasureText (text As String, font As Font, proposedSize As Size, flags As TextFormatFlags) As Size
Parámetros
- text
- String
Texto que se va a medir.
- flags
- TextFormatFlags
Las instrucciones de formato que se aplicarán al texto medido.
Devoluciones
, Sizeen píxeles, de text dibujado con el formato y especificados font .
Ejemplos
En el ejemplo de código siguiente se muestra cómo usar uno de los MeasureText métodos . Para ejecutar este ejemplo, pegue el código en un formulario Windows y llame a
private static void DrawALineOfText(PaintEventArgs e)
{
// Declare strings to render on the form.
string[] stringsToPaint = { "Tail", "Spin", " Toys" };
// Declare fonts for rendering the strings.
Font[] fonts = { new Font("Arial", 14, FontStyle.Regular),
new Font("Arial", 14, FontStyle.Italic),
new Font("Arial", 14, FontStyle.Regular) };
Point startPoint = new Point(10, 10);
// Set TextFormatFlags to no padding so strings are drawn together.
TextFormatFlags flags = TextFormatFlags.NoPadding;
// Declare a proposed size with dimensions set to the maximum integer value.
Size proposedSize = new Size(int.MaxValue, int.MaxValue);
// Measure each string with its font and NoPadding value and
// draw it to the form.
for (int i = 0; i < stringsToPaint.Length; i++)
{
Size size = TextRenderer.MeasureText(e.Graphics, stringsToPaint[i],
fonts[i], proposedSize, flags);
Rectangle rect = new Rectangle(startPoint, size);
TextRenderer.DrawText(e.Graphics, stringsToPaint[i], fonts[i],
startPoint, Color.Black, flags);
startPoint.X += size.Width;
}
}
Private Sub DrawALineOfText(ByVal e As PaintEventArgs)
' Declare strings to render on the form.
Dim stringsToPaint() As String = {"Tail", "Spin", " Toys"}
' Declare fonts for rendering the strings.
Dim fonts() As Font = {New Font("Arial", 14, FontStyle.Regular), _
New Font("Arial", 14, FontStyle.Italic), _
New Font("Arial", 14, FontStyle.Regular)}
Dim startPoint As New Point(10, 10)
' Set TextFormatFlags to no padding so strings are drawn together.
Dim flags As TextFormatFlags = TextFormatFlags.NoPadding
' Declare a proposed size with dimensions set to the maximum integer value.
Dim proposedSize As Size = New Size(Integer.MaxValue, Integer.MaxValue)
' Measure each string with its font and NoPadding value and draw it to the form.
For i As Integer = 0 To stringsToPaint.Length - 1
Dim size As Size = TextRenderer.MeasureText(e.Graphics, _
stringsToPaint(i), fonts(i), proposedSize, flags)
Dim rect As Rectangle = New Rectangle(startPoint, size)
TextRenderer.DrawText(e.Graphics, stringsToPaint(i), fonts(i), _
startPoint, Color.Black, flags)
startPoint.X += size.Width
Next
End Sub
Comentarios
MeasureText usa los proposedSize parámetros y flags para indicar la relación de alto al ancho al determinar el tamaño del texto. Al medir el texto en una sola línea, si el proposedSize parámetro representa un Size con una dimensión de alto mayor que Int32.MaxValue, el devuelto Size se ajustará para reflejar el alto real del texto.
Puede manipular cómo se dibuja el texto mediante una de las DrawText sobrecargas que toma un TextFormatFlags parámetro. Por ejemplo, el comportamiento predeterminado de TextRenderer es agregar relleno al rectángulo delimitador del texto dibujado para dar cabida a glifos de sobresalido. Si necesita dibujar una línea de texto sin estos espacios adicionales, debe usar las versiones de DrawText y MeasureText que toman un Size parámetro y TextFormatFlags . Para obtener un ejemplo, consulte MeasureText(IDeviceContext, String, Font, Size, TextFormatFlags).
Note
Esta sobrecarga de MeasureText(String, Font, Size, TextFormatFlags) omitirá un TextFormatFlags valor de NoPadding o LeftAndRightPadding. Si especifica un valor de relleno distinto del predeterminado, debe usar la sobrecarga de MeasureText(IDeviceContext, String, Font, Size, TextFormatFlags) que toma un IDeviceContext objeto .
Se aplica a
MeasureText(IDeviceContext, String, Font, Size, TextFormatFlags)
Proporciona el tamaño, en píxeles, del texto especificado cuando se dibuja con el contexto de dispositivo, la fuente y las instrucciones de formato especificados, utilizando el tamaño especificado para crear el rectángulo de límite inicial para el texto.
public:
static System::Drawing::Size MeasureText(System::Drawing::IDeviceContext ^ dc, System::String ^ text, System::Drawing::Font ^ font, System::Drawing::Size proposedSize, System::Windows::Forms::TextFormatFlags flags);
public static System.Drawing.Size MeasureText(System.Drawing.IDeviceContext dc, string text, System.Drawing.Font font, System.Drawing.Size proposedSize, System.Windows.Forms.TextFormatFlags flags);
static member MeasureText : System.Drawing.IDeviceContext * string * System.Drawing.Font * System.Drawing.Size * System.Windows.Forms.TextFormatFlags -> System.Drawing.Size
Public Shared Function MeasureText (dc As IDeviceContext, text As String, font As Font, proposedSize As Size, flags As TextFormatFlags) As Size
Parámetros
Contexto del dispositivo en el que se va a medir el texto.
- text
- String
Texto que se va a medir.
- flags
- TextFormatFlags
Las instrucciones de formato que se aplicarán al texto medido.
Devoluciones
, Sizeen píxeles, de text dibujado con el formato y especificados font .
Excepciones
dc es null.
Ejemplos
En el ejemplo siguiente se muestra cómo usar los MeasureText métodos y DrawText para dibujar una sola línea de texto en diferentes estilos de fuente. Para ejecutar este ejemplo, pegue el código siguiente en un formulario de Windows y llame a
private static void DrawALineOfText(PaintEventArgs e)
{
// Declare strings to render on the form.
string[] stringsToPaint = { "Tail", "Spin", " Toys" };
// Declare fonts for rendering the strings.
Font[] fonts = { new Font("Arial", 14, FontStyle.Regular),
new Font("Arial", 14, FontStyle.Italic),
new Font("Arial", 14, FontStyle.Regular) };
Point startPoint = new Point(10, 10);
// Set TextFormatFlags to no padding so strings are drawn together.
TextFormatFlags flags = TextFormatFlags.NoPadding;
// Declare a proposed size with dimensions set to the maximum integer value.
Size proposedSize = new Size(int.MaxValue, int.MaxValue);
// Measure each string with its font and NoPadding value and
// draw it to the form.
for (int i = 0; i < stringsToPaint.Length; i++)
{
Size size = TextRenderer.MeasureText(e.Graphics, stringsToPaint[i],
fonts[i], proposedSize, flags);
Rectangle rect = new Rectangle(startPoint, size);
TextRenderer.DrawText(e.Graphics, stringsToPaint[i], fonts[i],
startPoint, Color.Black, flags);
startPoint.X += size.Width;
}
}
Private Sub DrawALineOfText(ByVal e As PaintEventArgs)
' Declare strings to render on the form.
Dim stringsToPaint() As String = {"Tail", "Spin", " Toys"}
' Declare fonts for rendering the strings.
Dim fonts() As Font = {New Font("Arial", 14, FontStyle.Regular), _
New Font("Arial", 14, FontStyle.Italic), _
New Font("Arial", 14, FontStyle.Regular)}
Dim startPoint As New Point(10, 10)
' Set TextFormatFlags to no padding so strings are drawn together.
Dim flags As TextFormatFlags = TextFormatFlags.NoPadding
' Declare a proposed size with dimensions set to the maximum integer value.
Dim proposedSize As Size = New Size(Integer.MaxValue, Integer.MaxValue)
' Measure each string with its font and NoPadding value and draw it to the form.
For i As Integer = 0 To stringsToPaint.Length - 1
Dim size As Size = TextRenderer.MeasureText(e.Graphics, _
stringsToPaint(i), fonts(i), proposedSize, flags)
Dim rect As Rectangle = New Rectangle(startPoint, size)
TextRenderer.DrawText(e.Graphics, stringsToPaint(i), fonts(i), _
startPoint, Color.Black, flags)
startPoint.X += size.Width
Next
End Sub
Comentarios
El MeasureText método usa los proposedSize parámetros y flags para indicar la relación de alto al ancho al determinar el tamaño del texto. Al medir el texto en una sola línea, si el proposedSize parámetro representa un Size con una dimensión de alto mayor que Int32.MaxValue, el devuelto Size se ajustará para reflejar el alto real del texto.
Puede manipular cómo se dibuja el texto mediante una de las DrawText sobrecargas que toma un TextFormatFlags parámetro. Por ejemplo, el comportamiento predeterminado de TextRenderer es agregar relleno al rectángulo delimitador del texto dibujado para dar cabida a glifos de sobresalido. Si necesita dibujar una línea de texto sin estos espacios adicionales, use las versiones de DrawText y MeasureText que toman un Size parámetro y TextFormatFlags , como se muestra en el ejemplo.