打印输出,MeasureString问题
现在有一个问题,我在打印输出时,打印出来的文本,打印出来比在屏幕上看到的大!
哪位兄弟知道解决办法!
谢谢
protected overried void OnPaint(PaintEventargs e)
{
//这个是屏幕输出,计算出来的值比打印输出小
//float fwidth = g.MeasureString(Text, TextFont.ShowFont).Width;
DrawText(e.Graphics);
}
//打印输出
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
DrawText(e.Graphics);
}
private void DrawText(Graphics g)
{
float fheight = g.MeasureString(Text, TextFont.ShowFont).Height;
float fwidth = g.MeasureString(Text, TextFont.ShowFont).Width;
g.DrawString("Print Test",new Font("Verdana", 10),Brushs.Black,new Rectangle(10,10,(int)fheight,(int)fwidth);
}