实现效果:
知识运用:
Graphics类的DrawString方法
public void DrawString (string s, Font font, Brush brush,float x flloat y) //在指定位置且用指定的Brush和Font对象绘制指定的文本字符串
实现代码:
private void button1_Click(object sender, EventArgs e) { string str = "昏暗 与 灯火阑珊"; Graphics graphics = this.CreateGraphics(); Font font = new Font("华文行楷",25); SolidBrush myBrush = new SolidBrush(Color.PowderBlue); //创建画刷对象 graphics.DrawString(str,font,myBrush,50,60); //绘制图像 }