Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When printing a form in C# windows application I would like to make the form size matches the paper size so that all the form appears on the paper, also how to make some controls appear and others not appear on the print page.
I use Visual Studio 2012,

I would value your help.

I added PrintForm control to the form and wrote the following code:
C#
private void btnPrint_Click(object sender, EventArgs e)
       {

           this.printForm1.Print(this,  Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.PrintOption.FullWindow);
       }
Posted
Updated 28-Sep-13 21:54pm
v3
Comments
Pradeep Shukla 28-Sep-13 15:42pm    
You have to customize the print properties to fix the size to match the paper size as fit to paper. In order to customize what prints and what not.. is a tricky one. You have to actually send a modified screen for printing if that is what you want...
ZurdoDev 28-Sep-13 15:59pm    
Please use the improve question link to post your code for printing and then show us where you are stuck.
fgeaiessah 29-Sep-13 1:00am    
Dear prdshukla how to customize the print properties

Don't print the form: it never looks good.

Instead, use a PrintDocument[^] - it gives you complete control over the print operation and what is printed where.
 
Share this answer
 
Comments
Kenneth Haugland 28-Sep-13 17:38pm    
5'ed! If you want to print the form use Alt Gr + Print screen instead ;)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900