muckdog12
muckdog12

Reputation: 410

How do you Print in WPF (VB)

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

Upvotes: 0

Views: 1978

Answers (2)

SLaks
SLaks

Reputation: 888283

Use a PrintDialog.

Using dialog As New PrintDialog
    If dialog.ShowModal() Then dialog.PrintVisual(stackPanel)
End Using

Upvotes: 3

Ray
Ray

Reputation: 46605

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

Upvotes: 3

Related Questions