[讨论]怎样在pictureBox中直接输入文字?
有没有哪位兄弟做过,有给我点意见,谢谢!
[此贴子已经被作者于2006-8-31 8:15:26编辑过]
private void button1_Click(object sender, System.EventArgs e)
{
Graphics graphics = pictureBox1.CreateGraphics();
Font font = new Font("宋体",25);
string strTxt = "你要输入的文字";
SizeF sizeF = new SizeF(graphics.MeasureString(strTxt,font));
int X = (int) (pictureBox1.Width - sizeF.Width ) / 2;
int Y = (int) (pictureBox1.Height - sizeF.Height ) / 2;
graphics.DrawString(strTxt,font,new SolidBrush(Color.Blue),X,Y);
graphics.Dispose();
}