我的计算机中有jpeg文件。我如何在WPF中使用VB.NET打印该文件。我已经尝试使用printDialoge
方法
我当前的代码是:-
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnPrint.Click
Dim Pd As New PrintDialog
Dim vis As New DrawingVisual
Dim drc As DrawingContext
Dim img As System.Windows.Media.ImageSource
Dim img1 As BitmapImage
img1 = New BitmapImage(New Uri("C:\Windows\Temp\c.jpeg"))
img = img1
drc = vis.RenderOpen()
drc.DrawImage(img1, New Rect(New Size(img1.Width, img1.Height)))
If Pd.ShowDialog = True Then
Pd.PrintVisual(vis, "fdfd")
End If
End Sub