2014-03-19 61 views
1

我正在使用Visual C#。覆盖图片上的文字时,如何设置字体颜色?如何设置字体颜色?

graphicsImage.DrawString(textBox1.Text, 
new Font("Arial", 12, FontStyle.Bold) 
SystemBrushes.WindowText, new Point(10, 210));   
+0

u能PLZ添加您的XAML/ASPX问题? – Narendra

回答

0

尝试使用SolidBrush这样,你将获得红色字体:

graphicsImage.DrawString(textBox1.Text, new Font("Arial", 12, FontStyle.Bold), new SolidBrush(Color.Red), new Point(10, 210)); 
0

有没有FontColor财产,而应该使用正确的。 不要忘记处置IDisposable,你的情况:

using (Brush brush = new SolidBrush(Color.Red)) { // <- Let your text be red 
    using (Font font = new Font("Arial", 12, FontStyle.Bold)) { 
     // Paint the text with selected 
     // font - Arial 12 Bold 
     // brush - solid red 
     graphicsImage.Graphics.DrawString(
     textBox1.Text,  // <- what (text) 
     font,    // <- font 
     brush,    // <- color 
     new Point(10, 210)); // <- where 
    } 
    } 
相关问题