StringFormatFlags 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
텍스트 문자열의 표시 및 레이아웃 정보를 지정합니다.
이 열거형은 멤버 값의 비트 조합을 지원합니다.
public enum class StringFormatFlags
[System.Flags]
public enum StringFormatFlags
[<System.Flags>]
type StringFormatFlags =
Public Enum StringFormatFlags
- 상속
- 특성
필드
| Name | 값 | Description |
|---|---|---|
| DirectionRightToLeft | 1 | 텍스트가 오른쪽에서 왼쪽으로 표시됩니다. |
| DirectionVertical | 2 | 텍스트가 세로로 정렬됩니다. |
| FitBlackBox | 4 | 문자의 일부는 문자열의 레이아웃 사각형을 오버행할 수 있습니다. 기본적으로 문자는 오버행을 방지하기 위해 위치가 변경됩니다. |
| DisplayFormatControl | 32 | 왼쪽에서 오른쪽 표시와 같은 컨트롤 문자는 대표적인 문자 모양으로 출력에 표시됩니다. |
| NoFontFallback | 1024 | 요청된 글꼴에서 지원되지 않는 문자의 대체 글꼴로 대체하지 않도록 설정됩니다. 누락된 문자는 글꼴이 누락된 문자 모양(일반적으로 열린 사각형)과 함께 표시됩니다. |
| MeasureTrailingSpaces | 2048 | 각 줄의 끝에 후행 공백을 포함합니다. 기본적으로 메서드에서 반환하는 MeasureString 경계 사각형은 각 줄의 끝에 있는 공간을 제외합니다. 측정에 해당 공간을 포함하도록 이 플래그를 설정합니다. |
| NoWrap | 4096 | 사각형 내의 서식을 사용할 수 없는 경우 줄 사이에 텍스트 줄이 배치됩니다. 이 플래그는 사각형 대신 점이 전달되거나 지정된 사각형의 길이가 0인 경우에 암시됩니다. |
| LineLimit | 8192 | 서식 지정 사각형에는 전체 줄만 배치됩니다. 기본적으로 레이아웃은 텍스트가 끝날 때까지 또는 클리핑의 결과로 더 이상 선이 표시되지 않을 때까지 계속됩니다. 기본 설정을 사용하면 줄 높이의 전체 배수가 아닌 서식 지정 사각형으로 마지막 줄을 부분적으로 가릴 수 있습니다. 전체 줄만 표시되도록 하려면 이 값을 지정하고 적어도 한 줄의 높이만큼 높은 서식 사각형을 제공해야 합니다. |
| NoClip | 16384 | 문자 모양의 일부를 돌출하고 서식 사각형 바깥쪽에 도달하는 래핑 해제된 텍스트를 표시할 수 있습니다. 기본적으로 서식 사각형 외부에 도달하는 모든 텍스트와 문자 모양 부분이 잘립니다. |
예제
다음 코드 예제에서는 다음 멤버를 보여 줍니다.
이 예제는 Windows Forms와 함께 사용하도록 설계되었습니다. 폼에 코드를 붙여넣고 양식의 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 사용됩니다.
메모
FitBlackBox 필드의 이름이 잘못되었으며 해당 동작은 원래 GDI+ 구현의 필드와 유사 NoFitBlackBox 합니다.