Solved

Print Windows Form in C# 2008

Posted on 2011-02-24
3
799 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 74

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 74

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now