日期:2014-05-18  浏览次数:20816 次

急!!!!如果我用Graphics绘制好图后要怎么打印呢!?
如题,在CS下,怎么实现

------解决方案--------------------
用PrintDocument对象,注册其PrintPage事件,使用PrintPageEventArgs中包含的Graphics进行绘制。最后调用PrintDocument的Print方法打印。在此之前,需要设置PrintDocument的PrinterSettings属性,设置打印相关的信息。可以使用PrintDialog进行配置。
------解决方案--------------------
int height = System.Windows.Forms.SystemInformation.CaptionHeight;
Bitmap bit = new Bitmap(this.Width , this.Height);
this.DrawToBitmap(bit, new Rectangle(0,0,this.Width ,this.Height));

Bitmap b = new Bitmap(bit.Width, bit.Height - height);
Graphics g = Graphics.FromImage(b);
g.DrawImage(bit, new Rectangle(0, 0, b.Width, b.Height), new Rectangle(0, height, bit.Width, bit.Height - height), GraphicsUnit.Pixel);
b.Save( "D:\\a.bmp ");
bit.Dispose();
b.Dispose();

------解决方案--------------------
路过..接分.学习...
------解决方案--------------------
顶了
------解决方案--------------------
也顶
------解决方案--------------------
没做过

------解决方案--------------------
再学习
------解决方案--------------------
假如你的画图方法:
paint(Graphics g){
//画图;
}

你只要在printdocument的print方法中
private void pdEditor_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
paint(e.Graphics);
e.HasMorePages = true;
}