C#使用GraphicsPath在图像上偏斜文本

时间:2016-01-25 15:31:58

标签: c# gdi+ skew graphicspath

我目前正在使用以下代码向图像添加文字:

using (GraphicsPath graphicsPath = new GraphicsPath())
{
    graphicsPath.AddString(
        "sample text",
        new FontFamily("Times New Roman"),
        (int)FontStyle.Bold,
        graphics.DpiY * 12 / 72,
        new PointF(0,0),
        StringFormat.GenericDefault
    );

    graphics.FillPath(new SolidBrush(Color.Red), graphicsPath);
}

我这样做是为了让我有一条路径可以在以后添加文字边框。

我希望能够将文本倾斜为特定的X / Y值,但无法弄清楚如何操作。对GDI来说是新的。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:3)

使用这个链接,我找到了答案:

https://msdn.microsoft.com/en-us/library/a4t01h2x%28v=vs.110%29.aspx

<button class="btn">Button</button>
<input type="submit" class="btn" />
<a href="#" class="btn"></a>