是否可以指定使用
Graphics.DrawString
方法编写的文本的不透明度?
我正在做类似的事情,但如果可能的话希望我的文本是半透明的。
目前我正在做这个:
Graphics graphics = Graphics.FromImage(image);
graphics.DrawString("This is a watermark",
new Font("Arial", 40),
new SolidBrush(Color.Red),
0,
0);
尝试:
int opacity = 128; // 50% opaque (0 = invisible, 255 = fully opaque)
using (var graphics = Graphics.FromImage(image));
using (var font = new Font("Arial", 40));
using (var brush = new SolidBrush(Color.FromArgb(opacity, Color.Red)));
graphics.DrawString("This is a watermark", font, brush, 0, 0);
尝试
new SolidBrush(Color.FromArgb(0x78FF0000))
希望这有帮助