I have a WPF form that has a toolbar then a StackPanel under it with several controls inside of the StackPanel. One of the buttons on the toolbar is to print. I need to know how to print in a WPF, and more specifically how to print just what is inside of the stackpanel. I am using Visual Basic.NET
+3
A:
Something like this would do
PrintDialog dialog = new PrintDialog();
if (dialog.ShowModel() == true)
{
dialog.PrintVisual(myStackPanel);
}
Sorry for the C#, I don't know VB.NET but the idea is to use the PrintDialog.PrintVisual() method
Ray
2009-10-13 00:22:59
Someone who can translate to VB.NET feel free to edit my answer.
Ray
2009-10-13 00:25:52
Thanks. The actual printing job worked, but the margins when it printed were quite a bit off. What I am printing is just text.
muckdog12
2009-10-13 00:31:09
I know some of C#, so I was just fine. Thanks though
muckdog12
2009-10-13 00:31:43
+3
A:
Use a PrintDialog.
Using dialog As New PrintDialog
If dialog.ShowModal() Then dialog.PrintVisual(stackPanel)
End Using
SLaks
2009-10-13 00:29:42