StringFormatFlags 列挙型
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
テキスト文字列の表示情報とレイアウト情報を指定します。
この列挙体は、メンバー値のビットごとの組み合わせをサポートしています。
public enum class StringFormatFlags
[System.Flags]
public enum StringFormatFlags
[<System.Flags>]
type StringFormatFlags =
Public Enum StringFormatFlags
- 継承
- 属性
フィールド
| 名前 | 値 | 説明 |
|---|---|---|
| DirectionRightToLeft | 1 | テキストは右から左に表示されます。 |
| DirectionVertical | 2 | テキストは垂直方向に配置されます。 |
| FitBlackBox | 4 | 文字の一部は、文字列のレイアウトの四角形をオーバーハングできます。 既定では、オーバーハングを避けるために文字の位置が変更されます。 |
| DisplayFormatControl | 32 | 左から右のマークなどの制御文字は、代表的なグリフと共に出力に表示されます。 |
| NoFontFallback | 1024 | 要求されたフォントでサポートされていない文字の代替フォントへのフォールバックは無効になっています。 文字が見つからない場合は、フォントが見つからないグリフ (通常は開いた四角形) と共に表示されます。 |
| MeasureTrailingSpaces | 2048 | 各行の末尾に末尾のスペースが含まれます。 既定では、 MeasureString メソッドによって返される境界四角形は、各行の末尾のスペースを除外します。 このフラグを設定して、その空間を測定に含めます。 |
| NoWrap | 4096 | 四角形内の書式設定時に行間の文字列の折り返しが無効になります。 このフラグは、四角形の代わりにポイントが渡されたとき、または指定した四角形の長さが 0 の場合に暗黙的に指定されます。 |
| LineLimit | 8192 | 書式設定の四角形には、行全体のみがレイアウトされます。 既定では、レイアウトはテキストの末尾まで、またはクリッピングの結果として表示される行がそれ以上表示されないまで続行されます。どちらか早い方が優先されます。 既定の設定では、行の高さの倍数全体ではない書式設定の四角形によって最後の行が部分的に隠されます。 行全体のみが表示されるようにするには、この値を指定し、少なくとも 1 行の高さと同じ高さの書式設定四角形を指定するように注意してください。 |
| NoClip | 16384 | グリフの一部を張り出し、書式設定する四角形の外側に到達するラップされていないテキストを表示できます。 既定では、書式設定の四角形の外側に到達するすべてのテキストとグリフパーツがクリップされます。 |
例
次のコード例は、次のメンバーを示しています。
この例は、Windows フォームで使用するように設計されています。 フォームにコードを貼り付け、フォームのShowLineAndAlignment イベントを処理するときにPaint メソッドを呼び出し、eとして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
注釈
StringFormatFlags は、 StringFormat クラスによって使用されます。
Note
FitBlackBox フィールドの名前が間違っており、その動作は元の GDI+ 実装の NoFitBlackBox フィールドに似ています。