Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

General C# Printing question

Posted: Feb/15/2010   By: pankaj   Points:15   Category: .NET  - .NET Framework    Views:157   Vote Up (0)   Vote Down (0)    
I have been using C# for over a year, but just now am trying to implement printing.  My questions are very simple, and I'd like to find some sample code that answers them.  I have created (at design time) menu items for Page Setup, Print Preview, and Print; the following components: PrintDocument, PrintDialog, PrintPreviewDialog, PageSetupDialog, and have connected them appropriately.  I have an event handler that draws the items to be printed.  They are all lines and points, no text display or display of graphics files. Everything works, as far as it goes My questions are: In the printpage event hander, I gather that (if you have not applied any Transforms) that the unit for integer drawing commands is 1/100 inch.  Is this correct? I want to scale the drawing to fill the page, and I know the range of values.  Should I be using a ScaleTransform for this? What is the standard, straightforward way to store the PageSetup parameters in the registry so they are restored when the program is run again they will be restored?  I know how to read/write the Registry.  Should I be getting/setting to PrintDialog.DefaultPageSettings or somewhere else? Is there a standard way to to test for the case that a PC (such as a laptop) has no attached printer,so I can disable the menu items? There must be standard ways to address all these issues, but I haven't found it.  A sample program that addresses these would be very helpful. Thanks in advance, Michael Bate

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

Editor's Note: Healthy Printing

  
Why we use the paper we do.Joshua TrupinMSDN Magazine November 2006

Printing: Preview and Print from Your Windows Forms App with the .NET Printing Namespace

  
Printing is an integral part of every complete Windows-based application. Providing robust printing capabilities in these applications has often proved to be a tedious chore. Now, printing from Windows Forms with the .NET Framework means you must adopt a document-centric approach, resulting in cleaner and more manageable code. While the System.Windows.Forms namespace provides seamless integration with all the standard print dialogs (such as Print Preview, Page Setup, and Print), the System.Drawing.Printing namespace offers numerous classes for extensibility and customization. These classes, and how they provide access to printing capabilities, are covered here. Other useful techniques, such as printing in the background to allow the user to continue other tasks, is also explained.Alex CalvoMSDN Magazine February 2003
 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge