|
HowTo: Assign a PrintMethodAdapter to a Control in PrintForm.NET
ID: W3298003
Background
When PrintForm.NET encounters a control is doesn't know how to print it shows the error 'Error 0x0001. No PrintMethod available.' on the printout. (Note: these messages may not be shown on the printout if you have set PrintForm.ShowUnsupportedControlsOnPrintout = false).
This HowTo shows you how to assign an existing IPrintMethodAdapter implementation to the control so that PrintForm will use it to render the control on the printout.
Assigning a PrintMethodAdapter
In this example we retrieve the most commonly used PrintForm IPrintMethodAdapter implementation, PrintMethodPrint, and associate it with the type Infragistics.Win.UltraControlBase, part of the Infragistics control library. Note: in your code you would replace the Infragistics.Win.UltraControlBase with the Type you wish to associate with the given PrintMethodAdapter. Typically you would execute this code in the Form Load event handler, or in the constructor after InitializeComponent has been called.
C# Code Sample:
// retrieve the existing PrintMethodAdapter from PrintForm's internal collection:
TMGDevelopment.Printing.IPrintMethodAdapter pma = this.printForm1.GetPrintMethod(typeof(TMGDevelopment.Printing.PrintMethodPrint));
// add an extra supported type to the PrintMethodAdapter:
pma.AddSupportedType(typeof(Infragistics.Win.UltraControlBase));
VB.NET Code Sample:
' retrieve the existing PrintMethodAdapter from PrintForm's internal collection:
Dim pma As TMGDevelopment.Printing.IPrintMethodAdapter = Me.PrintForm1.GetPrintMethod(GetType(TMGDevelopment.Printing.PrintMethodPrint))
' add an extra supported type to the PrintMethodAdapter:
pma.AddSupportedType(GetType(Infragistics.Win.UltraControlBase))
Last updated
04-Apr-2006
|