public AddString ( string s, FontFamily family, int style, float emSize, Point origin, StringFormat format ) : void | ||
s | string | |
family | FontFamily | |
style | int | |
emSize | float | |
origin | Point | |
format | StringFormat | |
return | void |
using System.Drawing; using System.Drawing.Drawing2D; GraphicsPath path = new GraphicsPath(); path.AddString("Hello world", new FontFamily("Arial"), (int)FontStyle.Italic, 48, new Point(50, 100), StringFormat.GenericDefault);
using System.Drawing; using System.Drawing.Drawing2D; GraphicsPath path = new GraphicsPath(); path.AddString("Hello world", new FontFamily("Arial"), (int)FontStyle.BoldItalic, 72, new Point(50, 100), StringFormat.GenericTypographic | StringFormatFlags.DirectionVertical);In this example, we added the text "Hello world" to the path with a font size of 72 points and BoldItalic style. The text is positioned at the point (50, 100) on the graphics canvas. We used the StringFormat.GenericTypographic flag to ensure that the font is rendered as designed. Additionally, we used the StringFormatFlags.DirectionVertical flag to align the text vertically. These examples belong to the C# System.Drawing.Drawing2D package library.
public AddString ( string s, FontFamily family, int style, float emSize, Point origin, StringFormat format ) : void | ||
s | string | |
family | FontFamily | |
style | int | |
emSize | float | |
origin | Point | |
format | StringFormat | |
return | void |