日期:2014-05-17 浏览次数:21031 次
private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Bitmap bit = new Bitmap(frm.Width, frm.Height);
frm.DrawToBitmap(bit, new Rectangle(0, 0, frm.Width, frm.Height));
bit.Save("D://AAA.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
e.Graphics.DrawImage(bit, 0, 0, bit.Width, bit.Height);
bit.Dispose();
}
private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
foreach (Control c in frm.Controls)
{
if (c is UserLable)
{
e.Graphics.DrawString(c.Text, c.Font,
new SolidBrush(c.ForeColor), c.Location);
}
else if (c is PictureBox)
{
PictureBox b = (PictureBox)c;
e.Graphics.DrawImage(b.Image, c.Location.X,
c.Location.Y, c.Width, c.Height);
}
else if (c is BarcodeControl)
{
BarcodeControl b = (BarcodeControl)c;
Bitmap bit = new Bitmap(b.Width, b.Height);
b.DrawToBitmap(bit, new Rectangle(0, 0, b.Width, b.Height));
e.Graphics.DrawImage(bit, b.Location.X,b.Location.