简体   繁体   中英

Print winform in C#

How to print a whole winform in c# 2008.?

My form contains picturebox, 3 text boxes.

Use the PrintForm control in the Visual Basic PowerPack. It is available from the ToolBox in VS 2008 even in C# projects. I think it may have been added in SP1. More information here .

以为没有第三方库也可以做,我过去成功使用过PrintForm.Net

Use the following code.

using Microsoft.VisualBasic.PowerPacks.Printing;

private void printButton_Click(object sender, EventArgs e)
{
   printForm1.Print(this, PrintForm.PrintOption.ClientAreaOnly);
}

For PrintOptions See this link in MSDN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM