StringTrimming 列挙体
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Enumeration StringTrimming

メンバ名 | 説明 | |
---|---|---|
Character | テキストが最も近い文字にトリムされるよう指定します。 | |
EllipsisCharacter | テキストが最も近い文字にトリムされ、トリムされた行の末尾に省略記号が挿入されるよう指定します。 | |
EllipsisPath | 中央部分はトリムされた行から削除され、省略記号で置き換えられます。このアルゴリズムによって、行内の最後のスラッシュ区切りセグメントが最大限に確保されます。 | |
EllipsisWord | テキストが最も近い語にトリムされ、トリムされた行の末尾に省略記号が挿入されるよう指定します。 | |
None | トリムなしを指定します。 | |
Word | テキストが最も近い語にトリムされるよう指定します。 |

Trimming プロパティの設定方法と StringTrimming 列挙体の使用方法を次の例に示します。この例は、Windows フォームでの使用を意図してデザインされています。このコードをフォームに貼り付け、フォームの Paint イベントを処理するときに PaintEventArgs の e を渡して ShowStringTrimming メソッドを呼び出します。
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
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: 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.set_Trimming(StringTrimming.EllipsisWord); e.get_Graphics().DrawString(quote, this.get_Font(), Brushes.get_Black(), new RectangleF(10, 10, 90, 50), format1); } //ShowStringTrimming

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


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