GraphicsPath.AddStringとは? わかりやすく解説

GraphicsPath.AddString メソッド (String, FontFamily, Int32, Single, RectangleF, StringFormat)

パスに文字列を追加します。

名前空間: System.Drawing.Drawing2D
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub AddString ( _
    s As String, _
    family As FontFamily, _
    style As Integer, _
    emSize As Single, _
    layoutRect As RectangleF, _
    format As StringFormat _
)
Dim instance As GraphicsPath
Dim s As String
Dim family As FontFamily
Dim style As Integer
Dim emSize As Single
Dim layoutRect As RectangleF
Dim format As StringFormat

instance.AddString(s, family, style, emSize, layoutRect, format)
public void AddString (
    string s,
    FontFamily family,
    int style,
    float emSize,
    RectangleF layoutRect,
    StringFormat format
)
public:
void AddString (
    String^ s, 
    FontFamily^ family, 
    int style, 
    float emSize, 
    RectangleF layoutRect, 
    StringFormat^ format
)
public void AddString (
    String s, 
    FontFamily family, 
    int style, 
    float emSize, 
    RectangleF layoutRect, 
    StringFormat format
)
public function AddString (
    s : String, 
    family : FontFamily, 
    style : int, 
    emSize : float, 
    layoutRect : RectangleF, 
    format : StringFormat
)

パラメータ

s

追加する String。

family

テスト描画を行うときに使用するフォントの名前を表す FontFamily。

style

テキストに関するスタイル情報 (太字、斜体など) を表す FontStyle 列挙体。この値は、整数としてキャストする必要があります (後のコード例を参照)。

emSize

文字の境界を決める em 正方形ボックスの高さ。

layoutRect

テキストに外接する四角形を表す RectangleF。

format

行間や配置など、テキストの書式設定情報を指定する StringFormat。

使用例使用例

例については、AddString(String,FontFamily,Int32,Single,Point,StringFormat) のトピックを参照してください。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間

GraphicsPath.AddString メソッド (String, FontFamily, Int32, Single, Point, StringFormat)

パスに文字列を追加します。

名前空間: System.Drawing.Drawing2D
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub AddString ( _
    s As String, _
    family As FontFamily, _
    style As Integer, _
    emSize As Single, _
    origin As Point, _
    format As StringFormat _
)
Dim instance As GraphicsPath
Dim s As String
Dim family As FontFamily
Dim style As Integer
Dim emSize As Single
Dim origin As Point
Dim format As StringFormat

instance.AddString(s, family, style, emSize, origin, format)
public void AddString (
    string s,
    FontFamily family,
    int style,
    float emSize,
    Point origin,
    StringFormat format
)
public:
void AddString (
    String^ s, 
    FontFamily^ family, 
    int style, 
    float emSize, 
    Point origin, 
    StringFormat^ format
)
public void AddString (
    String s, 
    FontFamily family, 
    int style, 
    float emSize, 
    Point origin, 
    StringFormat format
)
public function AddString (
    s : String, 
    family : FontFamily, 
    style : int, 
    emSize : float, 
    origin : Point, 
    format : StringFormat
)

パラメータ

s

追加する String。

family

テスト描画を行うときに使用するフォントの名前を表す FontFamily。

style

テキストに関するスタイル情報 (太字、斜体など) を表す FontStyle 列挙体。この値は、整数としてキャストする必要があります (後のコード例を参照)。

emSize

文字の境界を決める em 正方形ボックスの高さ。

origin

テキストを開始する点を表す Point。

format

行間や配置など、テキストの書式設定情報を指定する StringFormat。

使用例使用例

次のコード例は、Windows フォームでの使用を意図してデザインされており、OnPaint イベント オブジェクトである PaintEventArgse が必要です。このコードは次のアクションを実行します。

重要な点が 2 つあります。1 つは、fontStyle 引数が整数としてキャストされることです。AddString メソッドでは、2 つ以上の FontStyle メンバを組み合わせて希望するフォント スタイル (この場合は Italic と Underline) を作成できるように、このキャストが必要です。もう 1 つは、DrawPath メソッドではなく FillPath メソッドが使用されることです。FillPath が使用された場合はソリッド テキストが描画されますが、DrawPath が使用された場合はテキストがアウトライン スタイルになります。

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
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);
}
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.get_GenericDefault();

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

    //Draw the path to the screen.
    e.get_Graphics().FillPath(Brushes.get_Black(), myPath);
} //AddStringExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間

GraphicsPath.AddString メソッド (String, FontFamily, Int32, Single, PointF, StringFormat)

パスに文字列を追加します。

名前空間: System.Drawing.Drawing2D
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub AddString ( _
    s As String, _
    family As FontFamily, _
    style As Integer, _
    emSize As Single, _
    origin As PointF, _
    format As StringFormat _
)
Dim instance As GraphicsPath
Dim s As String
Dim family As FontFamily
Dim style As Integer
Dim emSize As Single
Dim origin As PointF
Dim format As StringFormat

instance.AddString(s, family, style, emSize, origin, format)
public void AddString (
    string s,
    FontFamily family,
    int style,
    float emSize,
    PointF origin,
    StringFormat format
)
public:
void AddString (
    String^ s, 
    FontFamily^ family, 
    int style, 
    float emSize, 
    PointF origin, 
    StringFormat^ format
)
public void AddString (
    String s, 
    FontFamily family, 
    int style, 
    float emSize, 
    PointF origin, 
    StringFormat format
)
public function AddString (
    s : String, 
    family : FontFamily, 
    style : int, 
    emSize : float, 
    origin : PointF, 
    format : StringFormat
)

パラメータ

s

追加する String。

family

テスト描画を行うときに使用するフォントの名前を表す FontFamily。

style

テキストに関するスタイル情報 (太字、斜体など) を表す FontStyle 列挙体。この値は、整数としてキャストする必要があります (後のコード例を参照)。

emSize

文字の境界を決める em 正方形ボックスの高さ。

origin

テキストを開始する点を表す PointF。

format

行間や配置など、テキストの書式設定情報を指定する StringFormat。

使用例使用例

例については、AddString(String,FontFamily,Int32,Single,Point,StringFormat) のトピックを参照してください。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間

GraphicsPath.AddString メソッド (String, FontFamily, Int32, Single, Rectangle, StringFormat)

パスに文字列を追加します。

名前空間: System.Drawing.Drawing2D
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Sub AddString ( _
    s As String, _
    family As FontFamily, _
    style As Integer, _
    emSize As Single, _
    layoutRect As Rectangle, _
    format As StringFormat _
)
Dim instance As GraphicsPath
Dim s As String
Dim family As FontFamily
Dim style As Integer
Dim emSize As Single
Dim layoutRect As Rectangle
Dim format As StringFormat

instance.AddString(s, family, style, emSize, layoutRect, format)
public void AddString (
    string s,
    FontFamily family,
    int style,
    float emSize,
    Rectangle layoutRect,
    StringFormat format
)
public:
void AddString (
    String^ s, 
    FontFamily^ family, 
    int style, 
    float emSize, 
    Rectangle layoutRect, 
    StringFormat^ format
)
public void AddString (
    String s, 
    FontFamily family, 
    int style, 
    float emSize, 
    Rectangle layoutRect, 
    StringFormat format
)
public function AddString (
    s : String, 
    family : FontFamily, 
    style : int, 
    emSize : float, 
    layoutRect : Rectangle, 
    format : StringFormat
)

パラメータ

s

追加する String。

family

テスト描画を行うときに使用するフォントの名前を表す FontFamily。

style

テキストに関するスタイル情報 (太字、斜体など) を表す FontStyle 列挙体。この値は、整数としてキャストする必要があります (後のコード例を参照)。

emSize

文字の境界を決める em 正方形ボックスの高さ。

layoutRect

テキストに外接する四角形を表す Rectangle。

format

行間や配置など、テキストの書式設定情報を指定する StringFormat。

使用例使用例

例については、AddString(String,FontFamily,Int32,Single,Point,StringFormat) のトピックを参照してください。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間

GraphicsPath.AddString メソッド

パスに文字列を追加します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
GraphicsPath.AddString (String, FontFamily, Int32, Single, Point, StringFormat) パスに文字列を追加します。
GraphicsPath.AddString (String, FontFamily, Int32, Single, PointF, StringFormat) パスに文字列を追加します。
GraphicsPath.AddString (String, FontFamily, Int32, Single, Rectangle, StringFormat) パスに文字列を追加します。
GraphicsPath.AddString (String, FontFamily, Int32, Single, RectangleF, StringFormat) パスに文字列を追加します。
参照参照

関連項目

GraphicsPath クラス
GraphicsPath メンバ
System.Drawing.Drawing2D 名前空間



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「GraphicsPath.AddString」の関連用語

GraphicsPath.AddStringのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



GraphicsPath.AddStringのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS