Here how you will print image from your windows application
step 1:
Imports System.Drawing.Printing
Imports System.Drawing.Imaging
step2:
Drag and drop PrintDocument Control on your windows form and rename control name to: PrintGraphicControl
step3:
Put this in your code
Dim GraphicLocation as TextBox = New TextBox()
GraphicLocation.Text = "c:\myimage.jpg"
AddHandler PrintGraphicControl.PrintPage, AddressOf Me.GraphicPrint
PrintGraphicControl.Print()
#Region "Print Graphics"
Private Sub GraphicPrint(ByVal sender As Object, ByVal e As PrintPageEventArgs)
e.Graphics.DrawImage(Image.FromFile(GraphicLocation.Text), e.Graphics.VisibleClipBounds)
e.HasMorePages = False
End Sub
#End Region
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment