我获取屏幕的中间点,在中间点上画字符串,但此字符串是以中间点为起始点画,我想此字符串在中间点居中显示,请问如何解决?
---------------------------------------------------------------
用StringFarmat来控制...
Graphics g = e.Graphics;
SolidBrush sb = new SolidBrush(Color.Red);
Font HFont = new Font("宋体",12,FontStyle.Bold);
StringFormat fat = new StringFormat();
fat.Alignment = StringAlignment.Center;
g.DrawString("居中的文字", HFont,sb, 0, 0, fat); //这里文字以0,0为中心居中
g.Dispose();