StringFormat.Trimming Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the StringTrimming enumeration for this StringFormat object.
public:
property System::Drawing::StringTrimming Trimming { System::Drawing::StringTrimming get(); void set(System::Drawing::StringTrimming value); };
public System.Drawing.StringTrimming Trimming { get; set; }
member this.Trimming : System.Drawing.StringTrimming with get, set
Public Property Trimming As StringTrimming
Property Value
A StringTrimming enumeration that indicates how text drawn with this StringFormat object is trimmed when it exceeds the edges of the layout rectangle.
Examples
The following example shows how to set the Trimming property and how to use the StringTrimming enumeration. This example is designed to be used with a Windows Form. Paste this code into a form and call the ShowStringTrimming
method when handling the form's Paint event, passing e as 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
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기