日期:2014-05-18 浏览次数:20846 次
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) { Pen blackPen = new Pen(Color.Black, 3); //绘制文字 e.Graphics.DrawString(textBox1.Text, new Font("Monotype Corsiva", 50, FontStyle.Italic), Brushes.Black, 30, 125); //打印绘制矩形 e.Graphics.DrawRectangle(blackPen, 20, 20, 300, 200); //绘制图片 Image image = Image.FromStream(fs); e.Graphics.DrawImage(image, 20, 20); } private void btnPrint_Click(object sender, EventArgs e) { //设置页面并打印 printDocument1.DefaultPageSettings.Landscape = true; printDocument1.Print(); }
------解决方案--------------------
若做报表可以用专用的报表工具,如CrystalReport,ActiveReport,Reporting Service等