用PrintDocument(),贴段代码给你参考一下: Dim bmp_bay_map As Bitmap Dim bmpgraphics_bay_map As Graphics Dim pen_line As New Pen(Color.Black, 1) Dim print_result As New PrintDocument() bmp_bay_map = New Bitmap(Me.Pl_bay_map.Width, Me.Pl_bay_map.Height) bmpgraphics_bay_map = Graphics.FromImage(bmp_bay_map) Me.Pl_bay_map.BackgroundImage = bmp_bay_map ………………………………………………………… Private Sub btn_enter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_enter.Click Try Dim pd As New PrintDocument() 'pd.DefaultPageSettings.Landscape = True AddHandler pd.PrintPage, AddressOf printpageeventhandler ' pd.printpage=pd.printpage+new PrintPageEventHandler(me.printpageeventhandler); If (Me.storedpagesettings Is System.DBNull.Value) = False Then pd.DefaultPageSettings = Me.storedpagesettings End If pd.DefaultPageSettings.Landscape = True 'Dim dlg As New PrintDialog() 'dlg.Document = pd 'dlg.AllowSelection = True 'dlg.AllowSomePages = True 'Dim result As DialogResult 'result = dlg.ShowDialog 'If (result = DialogResult.OK) Then ' pd.Print() 'End If If (ptdlg Is Nothing) Then '第一次打印 ptdlg = New PrintDialog() ptdlg.Document = pd ptdlg.AllowSelection = False ptdlg.AllowSomePages = False ptdlg.AllowPrintToFile = False ptdlg.ShowHelp = False ' ptdlg.PrinterSettings. Dim result As DialogResult result = ptdlg.ShowDialog If (result = DialogResult.OK) Then pd.Print() End If Else '非第一次打印 pd.Print() End If Catch ex As System.Exception MsgBox(ex.Message) End Try End Sub Private Sub printpageeventhandler(ByVal obj As System.Object, ByVal ev As PrintPageEventArgs) Dim g As Graphics g = ev.Graphics If Len(Trim(Me.txt_scale_rate.Text)) > 0 Then Try Dim expandPercent As Single = CType(Me.txt_scale_rate.Text, Integer) / 100 g.ScaleTransform(expandPercent, expandPercent) Catch MsgBox("请在缩放比例中输入数字!", MsgBoxStyle.OKOnly, "提示") Exit Sub End Try End If ' g.ScaleTransform(0.8, 0.8) print_bay_map(g) ev.HasMorePages = False End Sub …………………………………… Private Sub print_bay_map(ByVal bmpgraphics_bay_map As Graphics) '现实 'Me.Pl_bay_map.Height = 1200 '清空 bmpgraphics_bay_map.Clear(Color.White) …… bmpgraphics_bay_map.DrawString(bay_col_cabin, Me.Font, Brushes.Black, distolefe + col_count * 20 + 40 * (j - strsmallcol + strcon) + 13, distotop + board_height + 80 + (big_row_cabin - small_row_cabin + 1) * 40 + 5 + 40) '贝列
Dim bmp_bay_map As Bitmap
Dim bmpgraphics_bay_map As Graphics
Dim pen_line As New Pen(Color.Black, 1)
Dim print_result As New PrintDocument() bmp_bay_map = New Bitmap(Me.Pl_bay_map.Width, Me.Pl_bay_map.Height)
bmpgraphics_bay_map = Graphics.FromImage(bmp_bay_map)
Me.Pl_bay_map.BackgroundImage = bmp_bay_map
…………………………………………………………
Private Sub btn_enter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_enter.Click
Try
Dim pd As New PrintDocument()
'pd.DefaultPageSettings.Landscape = True
AddHandler pd.PrintPage, AddressOf printpageeventhandler
' pd.printpage=pd.printpage+new PrintPageEventHandler(me.printpageeventhandler);
If (Me.storedpagesettings Is System.DBNull.Value) = False Then
pd.DefaultPageSettings = Me.storedpagesettings
End If
pd.DefaultPageSettings.Landscape = True
'Dim dlg As New PrintDialog()
'dlg.Document = pd
'dlg.AllowSelection = True
'dlg.AllowSomePages = True
'Dim result As DialogResult
'result = dlg.ShowDialog
'If (result = DialogResult.OK) Then
' pd.Print() 'End If
If (ptdlg Is Nothing) Then '第一次打印
ptdlg = New PrintDialog()
ptdlg.Document = pd
ptdlg.AllowSelection = False
ptdlg.AllowSomePages = False
ptdlg.AllowPrintToFile = False
ptdlg.ShowHelp = False
' ptdlg.PrinterSettings. Dim result As DialogResult
result = ptdlg.ShowDialog
If (result = DialogResult.OK) Then
pd.Print()
End If
Else
'非第一次打印
pd.Print()
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub printpageeventhandler(ByVal obj As System.Object, ByVal ev As PrintPageEventArgs)
Dim g As Graphics
g = ev.Graphics If Len(Trim(Me.txt_scale_rate.Text)) > 0 Then
Try
Dim expandPercent As Single = CType(Me.txt_scale_rate.Text, Integer) / 100
g.ScaleTransform(expandPercent, expandPercent)
Catch
MsgBox("请在缩放比例中输入数字!", MsgBoxStyle.OKOnly, "提示")
Exit Sub
End Try
End If
' g.ScaleTransform(0.8, 0.8)
print_bay_map(g)
ev.HasMorePages = False End Sub
……………………………………
Private Sub print_bay_map(ByVal bmpgraphics_bay_map As Graphics) '现实
'Me.Pl_bay_map.Height = 1200
'清空
bmpgraphics_bay_map.Clear(Color.White)
……
bmpgraphics_bay_map.DrawString(bay_col_cabin, Me.Font, Brushes.Black, distolefe + col_count * 20 + 40 * (j - strsmallcol + strcon) + 13, distotop + board_height + 80 + (big_row_cabin - small_row_cabin + 1) * 40 + 5 + 40) '贝列
End Sub