Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Print Windows Form in C# 2008

Posted on 2011-02-24
3
Medium Priority
?
811 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Screencast - Getting to Know the Pipeline

916 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