pictureBox里有图片,同时在pictureBox范围里还有label的内容。
我想把图片和label结合一起打印出来,该怎么做呢?
恩,是不是在打印事件里自己绘图?可不知道怎么绘制,请教了。

解决方案 »

  1.   

    to:sunzhong2003
    用CopyFromScreen?
    试了半天,
    问题1:打印屏幕的大小不知道怎么调整,打出来的都好小。
    问题2:我想截取的是屏幕中间的一部分,不知道怎么取
      

  2.   

    private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
     Rectangle rtg = new Rectangle(0 + e.MarginBounds.Left, 0 + e.MarginBounds.Top, pictureBox1.Width, pictureBox1.Height);
                    //绘制pictureBox1.Image 
                    e.Graphics.DrawImage(pictureBox1.Image, rtg, 0 + e.MarginBounds.Left, 0 + e.MarginBounds.Top, pictureBox1.Width, pictureBox1.Height, GraphicsUnit.Pixel);
                    //绘制label1
                    e.Graphics.DrawString(label1.Text, new Font("黑体", 10, FontStyle.Bold), Brushes.Black, label1.Location.X - pictureBox1.Location.X + e.MarginBounds.Left, label1.Location.Y - pictureBox1.Location.Y + e.MarginBounds.Top);
    }