日期:2014-05-17 浏览次数:22105 次
private string drawString;
private int FontSize;
public void panel_Paint(object sender, PaintEventArgs e)
{
Font drawFont = new Font("宋体", FontSize);
SolidBrush drawBrush = new SolidBrush(Color.Black);
Point drawPoint = new Point(0, 0);
e.Graphics.DrawString(drawString, drawFont, drawBrush, drawPoint);
/*
假定文字以label来看待,它的Size为(x,y),panel1的Size为(X,Y),如果x>X的话想另起一行的话该
怎么办呢?
也就是说drawFont所绘制的字符串长度为多少时,它的size的x或接近等于panel的size。有没有方法快速
得到呢?而不是用Graphics.MeasureString方法慢慢测量
*/
}