【发布时间】:2016-06-17 03:07:05
【问题描述】:
我正在使用以下代码向图像添加文本:
private void AddText(Graphics graphics, FontDetails fontDetails, Rectangle destination)
{
using (GraphicsPath graphicsPath = new GraphicsPath())
{
graphicsPath.AddString(
"My sample text",
fontDetails.FontFamily,
fontDetails.FontStyle,
fontDetails.FontEmHeight,
destination,
fontDetails.FontStringFormat
);
graphics.FillPath(new SolidBrush(FontColour), graphicsPath);
}
}
这是完美的工作。我希望能够对文本应用不透明效果,但似乎找不到执行此操作的选项。
任何帮助将不胜感激。
【问题讨论】:
-
使用 alpha,例如 FontColour = Color.FromArgb(32, Color.Black);扔掉画笔。
标签: c# text opacity graphicspath