实例067打印图片
程序员文章站
2024-03-08 10:11:04
...
Graphics.DrawImage 方法
控件 | 属性 | 值 | 控件 | 属性 | 值 |
Form | Name | Form1 | Panel | Name | Panel1 |
PicturesBox | Name | picBox | Button | Name | btnPrint |
Text | 打印图片 |
Public Class Form1
Private Sub print_PrintPage(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs)
e.Graphics.DrawImage(picBox.Image, e.Graphics.VisibleClipBounds)
End Sub
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
Dim pd As New Printing.PrintDocument
AddHandler pd.PrintPage, AddressOf print_PrintPage
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
picBox.Image = Image.FromFile("C:\Users\Administrator\Pictures\1.jpg")
End Sub
End Class