StringTrimming StringTrimming StringTrimming StringTrimming Enum

Definición

Especifica cómo recortar los caracteres de una cadena que no caben por completo en una forma de diseño.Specifies how to trim characters from a string that does not completely fit into a layout shape.

public enum class StringTrimming
public enum StringTrimming
type StringTrimming = 
Public Enum StringTrimming
Herencia
StringTrimmingStringTrimmingStringTrimmingStringTrimming

Campos

Character Character Character Character 1

Especifica que el texto se recorta hasta el carácter más cercano.Specifies that the text is trimmed to the nearest character.

EllipsisCharacter EllipsisCharacter EllipsisCharacter EllipsisCharacter 3

Especifica que el carácter se recorte hasta el carácter más cercano y se inserten puntos suspensivos al final de la línea recortada.Specifies that the text is trimmed to the nearest character, and an ellipsis is inserted at the end of a trimmed line.

EllipsisPath EllipsisPath EllipsisPath EllipsisPath 5

En las líneas recortadas se quita el centro y se sustituye por puntos suspensivos.The center is removed from trimmed lines and replaced by an ellipsis. El algoritmo mantiene la mayor parte posible del último segmento delimitado por barra diagonal de la línea.The algorithm keeps as much of the last slash-delimited segment of the line as possible.

EllipsisWord EllipsisWord EllipsisWord EllipsisWord 4

Especifica que el texto se recorta hasta la palabra más cercana y se insertan puntos suspensivos al final de la línea recortada.Specifies that text is trimmed to the nearest word, and an ellipsis is inserted at the end of a trimmed line.

None None None None 0

Especifica que no hay recorte.Specifies no trimming.

Word Word Word Word 2

Especifica que el texto se recorta hasta la palabra más cercana.Specifies that text is trimmed to the nearest word.

Ejemplos

El ejemplo siguiente muestra cómo establecer el Trimming propiedad y cómo usar el StringTrimming enumeración.The following example shows how to set the Trimming property and how to use the StringTrimming enumeration. En este ejemplo está diseñado para utilizarse con un formulario de Windows.This example is designed to be used with a Windows Form. Pegue este código en un formulario y llame al método ShowStringTrimming al control del formulario Paint evento, pasando e como PaintEventArgs.Paste this code into a form and call the ShowStringTrimming method when handling the form's Paint event, passing e as PaintEventArgs.

private:
   void ShowStringTrimming( PaintEventArgs^ e )
   {
      StringFormat^ format1 = gcnew StringFormat;
      String^ quote = "Not everything that can be counted counts,"
      " and not everything that counts can be counted.";
      format1->Trimming = StringTrimming::EllipsisWord;
      e->Graphics->DrawString( quote, this->Font, Brushes::Black, RectangleF(10.0F,10.0F,90.0F,50.0F), format1 );
   }
private void ShowStringTrimming(PaintEventArgs e)
{

    StringFormat format1 = new StringFormat();
    string quote = "Not everything that can be counted counts," +
        " and not everything that counts can be counted.";
    format1.Trimming = StringTrimming.EllipsisWord;
    e.Graphics.DrawString(quote, this.Font, Brushes.Black, 
        new RectangleF(10.0F, 10.0F, 90.0F, 50.0F), format1);
}
Private Sub ShowStringTrimming(ByVal e As PaintEventArgs)

    Dim format1 As New StringFormat
    Dim quote As String = "Not everything that can be counted counts," & _
        " and not everything that counts can be counted."
    format1.Trimming = StringTrimming.EllipsisWord
    e.Graphics.DrawString(quote, Me.Font, Brushes.Black, _
        New RectangleF(10.0F, 10.0F, 90.0F, 50.0F), format1)
End Sub

Se aplica a