printDocument设置适应边框打印 特重要 找了半天 设置一个属性即可

时间:2022-01-19 01:03:29
       private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//下面这个也设成高质量
e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
//下面这个设成High
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
e.Graphics.DrawImage(image,
e.Graphics.VisibleClipBounds);
e.HasMorePages = false;
}

  关键在于

e.Graphics.VisibleClipBounds 设置打印可见区域 即整个图片