Helper method to create a printable System.Windows.Controls.Canvas from an Leadtools.Windows.Controls.ImageBox, Leadtools.Windows.Controls.RasterImageBox, Leadtools.Windows.Controls.ImageViewer or Leadtools.Windows.Controls.RasterImageViewer control.
public virtual Canvas CreateCanvas(
UIElement element,
Leadtools.Windows.Printing.PrintPageEventArgs args
)
Public Overridable Function CreateCanvas( _
ByVal element As UIElement, _
ByVal args As Leadtools.Windows.Printing.PrintPageEventArgs _
) As Canvas
public:
virtual Canvas^ CreateCanvas(
UIElement^ element,
Leadtools.Windows.Printing.PrintPageEventArgs^ args
)
element
A System.Windows.UIElement that contains the Leadtools.Windows.Controls.ImageBox, Leadtools.Windows.Controls.RasterImageBox, Leadtools.Windows.Controls.ImageViewer or Leadtools.Windows.Controls.RasterImageViewer control to print.
args
Print arguments.
A System.Windows.Controls.Canvas that can be used with printing.
The PrinterHelper.CreateCanvas method can be used to create the System.Windows.UIElement to use as the visual paramater to the WPF PrintDialog.PrintVisual when using the System.Windows.Controls.PrintDialog class.
This method can also be used to create the System.Windows.UIElement to use as the Silverlight 4.0 and later PrintPageEventArgs.PageVisual property used when printing using the Silverlight 4.0 and later PrintDocument class.
Imports Leadtools.Windows.Controls
Imports Leadtools.Windows.Printing
Public Sub PrintViewerCanvasExample(ByVal viewer As ImageViewer)
Dim dlg As New PrintDialog()
If dlg.ShowDialog() = True Then
' Create the Visual from the viewer
Dim ph As New PrinterHelper()
ph.Destination = New Rect(0, 0, 1, 1)
ph.IsDestinationRelative = True
ph.HorizontalAlignment = HorizontalAlignment.Center
ph.VerticalAlignment = VerticalAlignment.Center
ph.ImageStretch = Stretch.UniformToFill
Dim args As New PrintPageEventArgs(New Thickness(), New Size(dlg.PrintableAreaWidth, dlg.PrintableAreaHeight))
Dim visual As Visual = ph.CreateCanvas(viewer, args)
dlg.PrintVisual(visual, "My Document")
End If
End Sub
using Leadtools.Windows.Controls;
using Leadtools.Windows.Printing;
public void PrintViewerCanvasExample(ImageViewer viewer)
{
PrintDialog dlg = new PrintDialog();
if(dlg.ShowDialog() == true)
{
// Create the Visual from the viewer
PrinterHelper ph = new PrinterHelper();
ph.Destination = new Rect(0, 0, 1, 1);
ph.IsDestinationRelative = true;
ph.HorizontalAlignment = HorizontalAlignment.Center;
ph.VerticalAlignment = VerticalAlignment.Center;
ph.ImageStretch = Stretch.UniformToFill;
PrintPageEventArgs args = new PrintPageEventArgs(new Thickness(), new Size(dlg.PrintableAreaWidth, dlg.PrintableAreaHeight));
Visual visual = ph.CreateCanvas(viewer, args);
dlg.PrintVisual(visual, "My Document");
}
}
Products |
Support |
Feedback: CreateCanvas Method - Leadtools.Windows.Controls |
Introduction |
Help Version 19.0.2017.3.22
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.