StringFormatFlags Énumération

Définition

Spécifie les informations d’affichage et de disposition pour les chaînes de texte.

Cette énumération prend en charge une combinaison au niveau du bit de ses valeurs membres.

public enum class StringFormatFlags
[System.Flags]
public enum StringFormatFlags
[<System.Flags>]
type StringFormatFlags = 
Public Enum StringFormatFlags
Héritage
StringFormatFlags
Attributs

Champs

Nom Valeur Description
DirectionRightToLeft 1

Le texte s’affiche de droite à gauche.

DirectionVertical 2

Le texte est aligné verticalement.

FitBlackBox 4

Les parties de caractères sont autorisées à surplomber le rectangle de disposition de la chaîne. Par défaut, les caractères sont repositionnés pour éviter tout surplomb.

DisplayFormatControl 32

Les caractères de contrôle tels que la marque de gauche à droite sont affichés dans la sortie avec un glyphe représentatif.

NoFontFallback 1024

La secours vers d’autres polices pour les caractères non pris en charge dans la police demandée est désactivée. Tous les caractères manquants sont affichés avec les polices manquantes glyphes, généralement un carré ouvert.

MeasureTrailingSpaces 2048

Inclut l’espace de fin à la fin de chaque ligne. Par défaut, le rectangle de limite retourné par la MeasureString méthode exclut l’espace à la fin de chaque ligne. Définissez cet indicateur pour inclure cet espace dans la mesure.

NoWrap 4096

L’habillage de texte entre les lignes lors de la mise en forme dans un rectangle est désactivé. Cet indicateur est implicite lorsqu’un point est passé au lieu d’un rectangle, ou lorsque le rectangle spécifié a une longueur de ligne nulle.

LineLimit 8192

Seules les lignes entières sont disposées dans le rectangle de mise en forme. Par défaut, la disposition se poursuit jusqu’à la fin du texte, ou jusqu’à ce qu’aucune ligne supplémentaire ne soit visible à la suite d’un découpage, selon ce qui se produit en premier. Notez que les paramètres par défaut permettent à la dernière ligne d’être partiellement masquée par un rectangle de mise en forme qui n’est pas un multiple entier de la hauteur de ligne. Pour vous assurer que seules les lignes entières sont vues, spécifiez cette valeur et veillez à fournir un rectangle de mise en forme au moins aussi haut que la hauteur d’une ligne.

NoClip 16384

Les parties en surplomb des glyphes et le texte non mis en évidence atteignant en dehors du rectangle de mise en forme sont autorisés à s’afficher. Par défaut, toutes les parties de texte et de glyphe qui atteignent en dehors du rectangle de mise en forme sont clippées.

Exemples

L’exemple de code suivant illustre les membres suivants :

Cet exemple est conçu pour être utilisé avec Windows Forms. Collez le code dans un formulaire et appelez la méthode lors de la ShowLineAndAlignment gestion de l’événement du Paint formulaire, en passant e en tant que PaintEventArgs.

private:
   void ShowLineAndAlignment( PaintEventArgs^ e )
   {
      // Construct a new Rectangle .
      Rectangle displayRectangle = Rectangle(Point(40,40),System::Drawing::Size( 80, 80 ));
      
      // Construct 2 new StringFormat objects
      StringFormat^ format1 = gcnew StringFormat( StringFormatFlags::NoClip );
      StringFormat^ format2 = gcnew StringFormat( format1 );
      
      // Set the LineAlignment and Alignment properties for
      // both StringFormat objects to different values.
      format1->LineAlignment = StringAlignment::Near;
      format1->Alignment = StringAlignment::Center;
      format2->LineAlignment = StringAlignment::Center;
      format2->Alignment = StringAlignment::Far;
      
      // Draw the bounding rectangle and a string for each
      // StringFormat object.
      e->Graphics->DrawRectangle( Pens::Black, displayRectangle );
      e->Graphics->DrawString( "Showing Format1", this->Font, Brushes::Red, displayRectangle, format1 );
      e->Graphics->DrawString( "Showing Format2", this->Font, Brushes::Red, displayRectangle, format2 );
   }
private void ShowLineAndAlignment(PaintEventArgs e)
{

    // Construct a new Rectangle .
    Rectangle  displayRectangle = 
        new Rectangle (new Point(40, 40), new Size (80, 80));

    // Construct 2 new StringFormat objects
    StringFormat format1 = new StringFormat(StringFormatFlags.NoClip);
    StringFormat format2 = new StringFormat(format1);

    // Set the LineAlignment and Alignment properties for
    // both StringFormat objects to different values.
    format1.LineAlignment = StringAlignment.Near;
    format1.Alignment = StringAlignment.Center;
    format2.LineAlignment = StringAlignment.Center;
    format2.Alignment = StringAlignment.Far;

    // Draw the bounding rectangle and a string for each
    // StringFormat object.
    e.Graphics.DrawRectangle(Pens.Black, displayRectangle);
    e.Graphics.DrawString("Showing Format1", this.Font, 
        Brushes.Red, (RectangleF)displayRectangle, format1);
    e.Graphics.DrawString("Showing Format2", this.Font, 
        Brushes.Red, (RectangleF)displayRectangle, format2);
}
Private Sub ShowLineAndAlignment(ByVal e As PaintEventArgs)

    ' Construct a new Rectangle.
    Dim displayRectangle _
        As New Rectangle(New Point(40, 40), New Size(80, 80))

    ' Construct two new StringFormat objects
    Dim format1 As New StringFormat(StringFormatFlags.NoClip)
    Dim format2 As New StringFormat(format1)

    ' Set the LineAlignment and Alignment properties for
    ' both StringFormat objects to different values.
    format1.LineAlignment = StringAlignment.Near
    format1.Alignment = StringAlignment.Center
    format2.LineAlignment = StringAlignment.Center
    format2.Alignment = StringAlignment.Far

    ' Draw the bounding rectangle and a string for each
    ' StringFormat object.
    e.Graphics.DrawRectangle(Pens.Black, displayRectangle)
    e.Graphics.DrawString("Showing Format1", Me.Font, Brushes.Red, _
        RectangleF.op_Implicit(displayRectangle), format1)
    e.Graphics.DrawString("Showing Format2", Me.Font, Brushes.Red, _
        RectangleF.op_Implicit(displayRectangle), format2)
End Sub

Remarques

StringFormatFlags est utilisé par la StringFormat classe.

Note

Le champ FitBlackBox a été mal nommé et son comportement est similaire au NoFitBlackBox champ dans l’implémentation GDI+ d’origine.

S’applique à