GraphicsPath.AddString 메서드

정의

이 경로에 텍스트 문자열을 추가합니다.

오버로드

Name Description
AddString(String, FontFamily, Int32, Single, Point, StringFormat)

이 경로에 텍스트 문자열을 추가합니다.

AddString(String, FontFamily, Int32, Single, PointF, StringFormat)

이 경로에 텍스트 문자열을 추가합니다.

AddString(String, FontFamily, Int32, Single, Rectangle, StringFormat)

이 경로에 텍스트 문자열을 추가합니다.

AddString(String, FontFamily, Int32, Single, RectangleF, StringFormat)

이 경로에 텍스트 문자열을 추가합니다.

AddString(String, FontFamily, Int32, Single, Point, StringFormat)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

이 경로에 텍스트 문자열을 추가합니다.

public:
 void AddString(System::String ^ s, System::Drawing::FontFamily ^ family, int style, float emSize, System::Drawing::Point origin, System::Drawing::StringFormat ^ format);
public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.Point origin, System.Drawing.StringFormat? format);
public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.Point origin, System.Drawing.StringFormat format);
member this.AddString : string * System.Drawing.FontFamily * int * single * System.Drawing.Point * System.Drawing.StringFormat -> unit
Public Sub AddString (s As String, family As FontFamily, style As Integer, emSize As Single, origin As Point, format As StringFormat)

매개 변수

s
String

추가할 개체입니다 String .

family
FontFamily

테스트를 그릴 글꼴의 이름을 나타내는 A FontFamily 입니다.

style
Int32

FontStyle 텍스트에 대한 스타일 정보(굵게, 기울임을 나타내는 등)를 나타내는 열거형입니다. 정수로 캐스팅해야 합니다(이 섹션의 뒷부분에 있는 예제 코드 참조).

emSize
Single

문자를 경계로 하는 em 사각형 상자의 높이입니다.

origin
Point

텍스트가 시작되는 지점을 나타내는 A Point 입니다.

format
StringFormat

줄 간격 및 맞춤과 같은 텍스트 서식 정보를 지정하는 A StringFormat 입니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 PaintEventArgs 이벤트 개체인 eOnPaint가 필요합니다. 코드는 다음 작업을 수행합니다.

  • 경로를 만듭니다.

  • 문자열 및 글꼴 인수를 설정합니다.

  • 경로에 문자열을 추가합니다.

  • 화면에 문자열을 그립니다.

두 가지 중요한 사항을 지적해야 합니다. 먼저 인수가 fontStyle 정수로 캐스팅됩니다. 이 메서드를 AddString 사용하려면 둘 이상의 FontStyle 멤버를 결합하여 원하는 글꼴 스타일(이 경우 ItalicUnderline)을 만들 수 있습니다. 둘째, 메서드가 FillPath 메서드 대신 사용된다는 것을 알 수 DrawPath 있습니다. 사용되는 경우 FillPath 단색 텍스트가 렌더링되는 반면 사용되는 경우 DrawPath 텍스트는 윤곽선 스타일이 됩니다.

private:
   void AddStringExample( PaintEventArgs^ e )
   {
      // Create a GraphicsPath object.
      GraphicsPath^ myPath = gcnew GraphicsPath;

      // Set up all the string parameters.
      String^ stringText = "Sample Text";
      FontFamily^ family = gcnew FontFamily( "Arial" );
      int fontStyle = (int)FontStyle::Italic;
      int emSize = 26;
      Point origin = Point(20,20);
      StringFormat^ format = StringFormat::GenericDefault;

      // Add the string to the path.
      myPath->AddString( stringText, family, fontStyle, (float)emSize, origin, format );

      //Draw the path to the screen.
      e->Graphics->FillPath( Brushes::Black, myPath );
   }
private void AddStringExample(PaintEventArgs e)
{
             
    // Create a GraphicsPath object.
    GraphicsPath myPath = new GraphicsPath();
             
    // Set up all the string parameters.
    string stringText = "Sample Text";
    FontFamily family = new FontFamily("Arial");
    int fontStyle = (int)FontStyle.Italic;
    int emSize = 26;
    Point origin = new Point(20, 20);
    StringFormat format = StringFormat.GenericDefault;
             
    // Add the string to the path.
    myPath.AddString(stringText,
        family,
        fontStyle,
        emSize,
        origin,
        format);
             
    //Draw the path to the screen.
    e.Graphics.FillPath(Brushes.Black, myPath);
}
Public Sub AddStringExample(ByVal e As PaintEventArgs)

    ' Create a GraphicsPath object.
    Dim myPath As New GraphicsPath

    ' Set up all the string parameters.
    Dim stringText As String = "Sample Text"
    Dim family As New FontFamily("Arial")
    Dim myfontStyle As Integer = CInt(FontStyle.Italic)
    Dim emSize As Integer = 26
    Dim origin As New Point(20, 20)
    Dim format As StringFormat = StringFormat.GenericDefault

    ' Add the string to the path.
    myPath.AddString(stringText, family, myfontStyle, emSize, _
    origin, format)

    'Draw the path to the screen.
    e.Graphics.FillPath(Brushes.Black, myPath)
End Sub

적용 대상

AddString(String, FontFamily, Int32, Single, PointF, StringFormat)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

이 경로에 텍스트 문자열을 추가합니다.

public:
 void AddString(System::String ^ s, System::Drawing::FontFamily ^ family, int style, float emSize, System::Drawing::PointF origin, System::Drawing::StringFormat ^ format);
public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.PointF origin, System.Drawing.StringFormat? format);
public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.PointF origin, System.Drawing.StringFormat format);
member this.AddString : string * System.Drawing.FontFamily * int * single * System.Drawing.PointF * System.Drawing.StringFormat -> unit
Public Sub AddString (s As String, family As FontFamily, style As Integer, emSize As Single, origin As PointF, format As StringFormat)

매개 변수

s
String

추가할 개체입니다 String .

family
FontFamily

테스트를 그릴 글꼴의 이름을 나타내는 A FontFamily 입니다.

style
Int32

FontStyle 텍스트에 대한 스타일 정보(굵게, 기울임을 나타내는 등)를 나타내는 열거형입니다. 정수로 캐스팅해야 합니다(이 섹션의 뒷부분에 있는 예제 코드 참조).

emSize
Single

문자를 경계로 하는 em 사각형 상자의 높이입니다.

origin
PointF

텍스트가 시작되는 지점을 나타내는 A PointF 입니다.

format
StringFormat

줄 간격 및 맞춤과 같은 텍스트 서식 정보를 지정하는 A StringFormat 입니다.

예제

예제를 보려면 AddString(String, FontFamily, Int32, Single, Point, StringFormat)를 참조하세요.

적용 대상

AddString(String, FontFamily, Int32, Single, Rectangle, StringFormat)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

이 경로에 텍스트 문자열을 추가합니다.

public:
 void AddString(System::String ^ s, System::Drawing::FontFamily ^ family, int style, float emSize, System::Drawing::Rectangle layoutRect, System::Drawing::StringFormat ^ format);
public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.Rectangle layoutRect, System.Drawing.StringFormat? format);
public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.Rectangle layoutRect, System.Drawing.StringFormat format);
member this.AddString : string * System.Drawing.FontFamily * int * single * System.Drawing.Rectangle * System.Drawing.StringFormat -> unit
Public Sub AddString (s As String, family As FontFamily, style As Integer, emSize As Single, layoutRect As Rectangle, format As StringFormat)

매개 변수

s
String

추가할 개체입니다 String .

family
FontFamily

테스트를 그릴 글꼴의 이름을 나타내는 A FontFamily 입니다.

style
Int32

FontStyle 텍스트에 대한 스타일 정보(굵게, 기울임을 나타내는 등)를 나타내는 열거형입니다. 정수로 캐스팅해야 합니다(이 섹션의 뒷부분에 있는 예제 코드 참조).

emSize
Single

문자를 경계로 하는 em 사각형 상자의 높이입니다.

layoutRect
Rectangle

Rectangle 텍스트를 경계로 하는 사각형을 나타내는 A입니다.

format
StringFormat

줄 간격 및 맞춤과 같은 텍스트 서식 정보를 지정하는 A StringFormat 입니다.

예제

예제를 보려면 AddString(String, FontFamily, Int32, Single, Point, StringFormat)를 참조하세요.

적용 대상

AddString(String, FontFamily, Int32, Single, RectangleF, StringFormat)

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
GraphicsPath.cs

이 경로에 텍스트 문자열을 추가합니다.

public:
 void AddString(System::String ^ s, System::Drawing::FontFamily ^ family, int style, float emSize, System::Drawing::RectangleF layoutRect, System::Drawing::StringFormat ^ format);
public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.RectangleF layoutRect, System.Drawing.StringFormat? format);
public void AddString(string s, System.Drawing.FontFamily family, int style, float emSize, System.Drawing.RectangleF layoutRect, System.Drawing.StringFormat format);
member this.AddString : string * System.Drawing.FontFamily * int * single * System.Drawing.RectangleF * System.Drawing.StringFormat -> unit
Public Sub AddString (s As String, family As FontFamily, style As Integer, emSize As Single, layoutRect As RectangleF, format As StringFormat)

매개 변수

s
String

추가할 개체입니다 String .

family
FontFamily

테스트를 그릴 글꼴의 이름을 나타내는 A FontFamily 입니다.

style
Int32

FontStyle 텍스트에 대한 스타일 정보(굵게, 기울임을 나타내는 등)를 나타내는 열거형입니다. 정수로 캐스팅해야 합니다(이 섹션의 뒷부분에 있는 예제 코드 참조).

emSize
Single

문자를 경계로 하는 em 사각형 상자의 높이입니다.

layoutRect
RectangleF

RectangleF 텍스트를 경계로 하는 사각형을 나타내는 A입니다.

format
StringFormat

줄 간격 및 맞춤과 같은 텍스트 서식 정보를 지정하는 A StringFormat 입니다.

예제

예제를 보려면 AddString(String, FontFamily, Int32, Single, Point, StringFormat)를 참조하세요.

적용 대상