您的位置:首页 > 其它

GDI+绘制竖向文本

2011-08-02 13:00 239 查看
可通过 StringFormat sF = new StringFormat(StringFormatFlags.DirectionVertical);以及使用 g.DrawString(s, f, Brushes.Black, rf,sF);来绘制竖向文本

View Code private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Font f = new Font("Aris", 15, FontStyle.Italic);
string s = "this is my name ,and what";
StringFormat sF = new StringFormat(StringFormatFlags.DirectionVertical);
SizeF sf = g.MeasureString(s, f, 100);
RectangleF rf = new RectangleF(20, 20, sf.Width, sf.Height);
g.DrawRectangle(Pens.Red, rf.Left, rf.Top, rf.Width, rf.Height);
g.DrawString(s, f, Brushes.Black, rf,sF);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: