Files
docs-desktop/dotnet-desktop-guide/framework/winforms/advanced/how-to-print-a-windows-form.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

1.5 KiB

title, description, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title description ms.date dev_langs helpviewer_keywords ms.assetid
How to: Print a Windows Form Learn how to programmatically print a copy of the current Windows Form by using the CopyFromScreen method. 03/30/2017
csharp
vb
Windows Forms, printing
printing [Windows Forms]
printing a form
printing [Windows Forms], printing a form
c8dff5f8-f56a-4c07-ae31-64643b31f8fc

How to: Print a Windows Form

As part of the development process, you typically will want to print a copy of your Windows Form. The following code example shows how to print a copy of the current form by using the xref:System.Drawing.Graphics.CopyFromScreen%2A method.

Example

[!code-csharpSystem.Drawing.Graphics.CopyFromScreen#1] [!code-vbSystem.Drawing.Graphics.CopyFromScreen#1]

Robust Programming

The following conditions may cause an exception:

  • You do not have permission to access the printer.

  • There is no printer installed.

.NET Framework Security

In order to run this code example, you must have permission to access the printer you use with your computer.

See also