Cette énumération possède un attribut FlagsAttribute qui permet la combinaison d'opérations de bits de ses valeurs membres.
Espace de noms : System.DrawingAssembly : System.Drawing (dans system.drawing.dll)
Syntaxe<FlagsAttribute> _
Public Enumeration StringFormatFlags
Dim instance As StringFormatFlags
[FlagsAttribute]
public enum StringFormatFlags
[FlagsAttribute] public enum class StringFormatFlags
/** @attribute FlagsAttribute() */
public enum StringFormatFlags
FlagsAttribute
public enum StringFormatFlags
Membres| Nom de membre | Description | |
|---|---|---|
| DirectionRightToLeft | Le texte est affiché de droite à gauche. | |
| DirectionVertical | Le texte est aligné verticalement. | |
| DisplayFormatControl | Les caractères de contrôle, tels que la marque de gauche à droite, sont affichés dans la sortie avec un glyphe représentatif. | |
| FitBlackBox | 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. | |
| LineLimit | Seules des lignes entières sont présentées dans le rectangle de mise en forme. Par défaut, la mise en page continue jusqu'à la fin du texte ou jusqu'à ce que plus aucune ligne ne soit visible en raison du découpage, selon le cas. Notez que les paramètres par défaut permettent à la dernière ligne d'être partiellement obscurcie par un rectangle de mise en forme qui n'est pas un multiple entier de la hauteur de la ligne. Pour garantir que seules les lignes entières sont vues, spécifiez cette valeur et veillez à fournir un rectangle de mise en forme au moins aussi grand que la hauteur d'une ligne. | |
| MeasureTrailingSpaces | Inclut l'espace de fin à la fin de chaque ligne. Par défaut, le rectangle ajusté retourné par la méthode MeasureString exclut l'espace à la fin de chaque ligne. Définissez cet indicateur pour inclure cet espace dans la mesure. | |
![]() | NoClip | Les parties des glyphes surplombants et le texte désencapsulé sortant du rectangle de mise en forme peuvent s'afficher. Par défaut, toutes les parties des glyphes et du texte qui sortent du rectangle de mise en forme sont découpés. |
| NoFontFallback | Utilisation de polices de substitution pour les caractères qui ne sont pas pris en charge dans la police demandée. Les caractères manquants sont affichés avec le glyphe des caractères manquants, généralement un carré ouvert. | |
![]() | NoWrap | Habillage du texte entre les lignes lorsque la mise en forme dans un rectangle est désactivée. Cet indicateur est impliqué lorsqu'un point est passé au lieu d'un rectangle ou lorsque le rectangle spécifié a une longueur de ligne nulle. |
NotesStringFormatFlags est utilisé par la classe StringFormat.
Remarque |
|---|
| Le champ FitBlackBox a été nommé incorrectement et son comportement est semblable au champ NoFitBlackBox dans l'implémentation GDI+ d'origine. |
ExempleL'exemple de code suivant illustre les membres suivants :
-
StringFormatFlags
Cet exemple est conçu pour être utilisé avec Windows Forms. Collez le code dans un formulaire et appelez la méthode ShowLineAndAlignment lors de la gestion de l'événement Paint du formulaire, en passant l'argument e comme PaintEventArgs.
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
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: 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.set_LineAlignment(StringAlignment.Near); format1.set_Alignment(StringAlignment.Center); format2.set_LineAlignment(StringAlignment.Center); format2.set_Alignment(StringAlignment.Far); // Draw the bounding rectangle and a string for each // StringFormat object. e.get_Graphics().DrawRectangle(Pens.get_Black(), displayRectangle); e.get_Graphics().DrawString("Showing Format1", this.get_Font(), Brushes.get_Red(), (RectangleF.op_Implicit((displayRectangle))), format1); e.get_Graphics().DrawString("Showing Format2", this.get_Font(), Brushes.get_Red(), RectangleF.op_Implicit((displayRectangle)), format2); } //ShowLineAndAlignment
Plates-formesWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Informations de version
Remarque
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ