我正在尝试使用下面的代码打印位图,但它不起作用。我不知道为什么......
private void btnImprimir_Click(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += PrintPage;
pd.Print();
}
private void PrintPage(object o, PrintPageEventArgs e)
{
button1.Visible = false;
button2.Visible = false;
button3.Visible = false;
button4.Visible = false;
Bitmap bitmap = new Bitmap(this.Width, this.Height);
this.DrawToBitmap(bitmap, this.ClientRectangle);
Point loc = new Point(this.Width, this.Height);
e.Graphics.DrawImage(bitmap, loc);
button1.Visible = true;
button2.Visible = true;
button3.Visible = true;
button4.Visible = true;
}