StringTrimming Výčet

Definice

Určuje, jak oříznout znaky z řetězce, který se zcela nevejde do obrazce rozložení.

public enum class StringTrimming
public enum StringTrimming
type StringTrimming = 
Public Enum StringTrimming
Dědičnost
StringTrimming

Pole

Character 1

Určuje, že se text oříznou na nejbližší znak.

EllipsisCharacter 3

Určuje, že se text ořízne na nejbližší znak a na konec oříznutého řádku se vloží tři tečky.

EllipsisPath 5

Střed se odebere z oříznutých čar a nahradí se třemi tečkami. Algoritmus zachová co nejvíce posledního lomítkem odděleného segmentu řádku.

EllipsisWord 4

Určuje, že text se ořízne na nejbližší slovo a na konec oříznutého řádku se vloží tři tečky.

None 0

Určuje žádné oříznutí.

Word 2

Určuje, že se text oříznou na nejbližší slovo.

Příklady

Následující příklad ukazuje, jak nastavit Trimming vlastnost a jak použít StringTrimming výčet. Tento příklad je navržený pro použití s formulářem Windows. Vložte tento kód do formuláře a při zpracování události formuláře Paint volejte metodu ShowStringTrimming a předejte e jako PaintEventArgs.

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.Trimming = StringTrimming.EllipsisWord;
    e.Graphics.DrawString(quote, this.Font, Brushes.Black, 
        new RectangleF(10.0F, 10.0F, 90.0F, 50.0F), format1);
}
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

Platí pro