Print Windows form in c#

后端 未结 3 1332
醉酒成梦
醉酒成梦 2021-01-16 01:17

I am trying to print a form using this code:

private void btnPrint_Click(object sender, EventArgs e)
    {
        Graphics g1 = this.CreateGraphics();
              


        
3条回答
  •  生来不讨喜
    2021-01-16 01:51

    Add:

    using System.Drawing.Printing;
    

    and in your code, add:

    PrintDocument printDocument1 = new PrintDocument();
    

    More info here

提交回复
热议问题