SoFunction
Updated on 2025-03-07

Example of the usage of AddString method of GraphicsPath in C#

This article describes the usage of the AddString method of GraphicsPath in C#. Share it for your reference. The details are as follows:

using System;
using ;
using ;
using ;
using ;
using ;
using ;
using .Drawing2D;
namespace advanced_drawing
{
  public partial class Form14 : Form
  {
    public Form14()
    {
      InitializeComponent();
    }
    private void Form14_Paint(object sender, 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);
      int emSize = 26;
      Point origin = new Point(20, 20);
      StringFormat format = ;
      // Add the string to the path.
      (stringText,
        family,
        fontStyle,
        emSize,
        origin,
        format);
      //Draw the path to the screen.
      (, myPath);
    }
  }
}

I hope this article will be helpful to everyone's C# programming.