StringFormatFlags 列挙体
この列挙体には、メンバ値のビットごとの組み合わせを可能にする FlagsAttribute 属性が含まれています。
名前空間: System.Drawingアセンブリ: System.Drawing (system.drawing.dll 内)

<FlagsAttribute> _ Public Enumeration StringFormatFlags

メンバ名 | 説明 | |
---|---|---|
DirectionRightToLeft | テキストを右から左へ表示します。 | |
DirectionVertical | テキストを縦方向に位置合わせします。 | |
DisplayFormatControl | 左から右を指示するマークなどの制御文字をグリフで表現します。 | |
FitBlackBox | 文字の一部が文字列のレイアウト四角形からはみ出すことを許可します。既定では、はみ出さないように文字が移動されます。 | |
LineLimit | 書式指定用の四角形には、完全な直線だけがレイアウトされます。既定では、クリッピングの結果、テキストの末尾が表示された状態、または行が表示されなくなった状態のうち、いずれか早い方の状態になるまでレイアウトが継続します。既定の設定では、行高さの整数倍でない書式指定用四角形を用いた場合は、最後の行の一部が隠れることがあります。必ず行全体が表示されるようにするには、この値を指定した上で、少なくとも 1 つの行と高さが同じの書式指定用の四角形を使用してください。 | |
MeasureTrailingSpaces | 各行の行末に空白を含めます。既定では、MeasureString メソッドから返される外接四角形によって、各行末の空白が除外されます。各行末の空白を計測に含める場合はこのフラグを設定します。 | |
![]() | NoClip | グリフの突出部と書式指定用の四角形からはみ出すラップされていないテキストを表示できます。既定では、書式指定用の四角形からはみ出たテキストとグリフ部はすべてクリップされます。 |
NoFontFallback | 要求されたフォントでサポートされていない文字のフォントを切り替えるフォールバックを無効にします。欠落文字は、グリフの欠落したフォント (通常は空白の正方形) で表示されます。 | |
![]() | NoWrap | 四角形内の書式を指定するときに、行のテキストの折り返しを無効にします。このフラグは、四角形ではなく点が渡された場合、または長さゼロの行の四角形が指定された場合に暗黙的に指定されます。 |

StringFormatFlags は StringFormat クラスで使用されます。
![]() |
---|
FitBlackBox フィールドは名前が不適切です。このフィールドの動作は、元の GDI+ 実装の NoFitBlackBox フィールドの動作と似ています。 |

この例は、Windows フォームでの使用を意図してデザインされています。コードをフォームに貼り付け、フォームの Paint イベントを処理するときに PaintEventArgs の e を渡して ShowLineAndAlignment メソッドを呼び出します。
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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からStringFormatFlags 列挙体を検索する場合は、下記のリンクをクリックしてください。

- StringFormatFlags 列挙体のページへのリンク