GraphicsPath.AddString メソッド (String, FontFamily, Int32, Single, RectangleF, StringFormat)
アセンブリ: 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 )


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


GraphicsPath.AddString メソッド (String, FontFamily, Int32, Single, Point, StringFormat)
アセンブリ: 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 )

次のコード例は、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

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


GraphicsPath.AddString メソッド (String, FontFamily, Int32, Single, PointF, StringFormat)
アセンブリ: 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 )


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


GraphicsPath.AddString メソッド (String, FontFamily, Int32, Single, Rectangle, StringFormat)
アセンブリ: 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 )


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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.AddString メソッドのページへのリンク