Solved

Print Windows Form in C# 2008

Posted on 2011-02-24
3
802 Views
Last Modified: 2012-05-11
Hello,

I want to print a form that contains Visual Basic PowerPacks controls such as LineShape and RectangleShape and many labels, the form construct a very complex report.

I  want to print the form as Landscape and have a list of connected printers displayed.
0
Comment
Question by:smetechit
  • 2
3 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 34972405
If you have PowerPacks installed, it should have come with a PrintForm control. Have you tried it? If so, are you saying that it doesn't work when using other PowerPack controls?
0
 

Author Comment

by:smetechit
ID: 34977159
My problem how to chnge printer settings to Landscape.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 34979229
This worked for me:

Add a PrintDialog control to your form in addition to the PrintForm control. Then, add similar code to this:

if (this.printDialog1.ShowDialog() == DialogResult.OK)
{
    this.printForm1.PrinterSettings = this.printDialog1.PrinterSettings;
    this.printForm1.Print();
}

Open in new window


The user will be shown the "select printer" dialog, at which point they can change page orientation as well.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run time Error 4 47
Code works but it's slow 28 70
SqlDataBase 7 48
C# winforms programmitically move panels 6 29
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question