开发者

How do you Print in WPF (VB)

开发者 https://www.devze.com 2022-12-08 03:09 出处:网络
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 开发者_如何学Cprint. I need to know how to print

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 开发者_如何学Cprint. 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


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


Use a PrintDialog.

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号