c#窗口打印,和打印预览效果不一样是什么回事啊
右边设置了一个A4的窗口(595,842),在最边边边上有个文本框,里面有文字,明明是靠在A4的边上,为什么打印预览的时候就空出来那么多呢?
代码如下
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Graphics g = e.Graphics;
foreach (Control crl in this.Controls)
{
int Left = crl.Location.X;
int Top = crl.Location.Y;
int width = crl.Width;
int height = crl.Height;
Font prnFont = new Font(crl.Font.Name, crl.Font.Size, crl.Font.Style);
Rectangle r = new Rectangle(Left,Top,width,height);
g.DrawRectangle( Pens.White,r);
SolidBrush prnBrush = new SolidBrush(crl.ForeColor);
g.DrawString(crl.Text, prnFont, prnBrush,r);//在长方形画字符串
}
} --------------------编程问答-------------------- 左边设置了一个A4的窗口(595,842),在最右边边边上有个文本框,里面有文字,明明是靠在A4的边上,为什么打印预览的时候就空出来那么多呢?
补充:.NET技术 , C#