PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


GTP.NET FAQ 11228


How can I choose which printer to use? Please note that this article refers to the GTP.NET
Jump to article- 2008-05-14 19:01:00 - Email plexityHide

Question

 

Using the print facilities of your object I can just launch the print preview based on the current default printer and its configurations (like paper size, etc).

 

I wonder how can do to let the user to select which printer to use and to properly configure it before printing the gantt.

 

Answer

 

Stole this more or less from MSDN:

public void Printing(string printer) {
 
try {
    streamToPrint =
new StreamReader (filePath);
   
try {
      printFont =
new Font("Arial", 10);
      PrintDocument pd =
new PrintDocument();
      pd.PrintPage +=
new PrintPageEventHandler(pd_PrintPage);
     
// Specify the printer to use.
      pd.PrinterSettings.PrinterName = printer;

     
if (pd.PrinterSettings.IsValid) {
         pd.Print();
      }
     
else {   
         MessageBox.Show(
"Printer is invalid.");
      }
    }
   
finally {
      streamToPrint.Close();
    }
  }
 
catch(Exception ex) {
    MessageBox.Show(ex.Message);
  }
}

 

 

 

Google
WWW plexityHide GTP.NET FAQ
Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ GTP.NET.SL and WPF

FAQ general

Testimonials

"This is too GREAT. I must say you have strong support and really good programmers at your place. Your entire team is good. Just Fantastic! – 100%"
Gaurav Patole,
WebTechDevelopers
More testimonials...




class="blk">PlexityHide.com
Grastensvagen 24, S-163 45 Spanga Sweden
E-mail: support@plexityhide.com