Private Sub btnPrintGraph_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.Cursor = Cursors.WaitCursor Try If Not objPrintChart Is Nothing Then Me.PageSetupDialog1.PageSettings.Landscape = True tmpGraphFile = GetJpgFilePath() If (Me.PrintDialog1.ShowDialog = DialogResult.OK) Then printDocGraph.Print() End If End If Catch ex As Exception MessageBox.Show(ex.Message, MESSAGEBOX_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Information) Finally Me.Cursor = Cursors.Default End Try End Sub Private Sub printDocGraph_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printDocGraph.PrintPage Dim gg As New Bitmap(tmpGraphFile) e.Graphics.DrawImage(gg, 10, 20, e.PageBounds.Width - 50, e.MarginBounds.Height - 20) gg.Dispose() End Sub
Me.Cursor = Cursors.WaitCursor
Try
If Not objPrintChart Is Nothing Then
Me.PageSetupDialog1.PageSettings.Landscape = True
tmpGraphFile = GetJpgFilePath()
If (Me.PrintDialog1.ShowDialog = DialogResult.OK) Then
printDocGraph.Print()
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message, MESSAGEBOX_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Information)
Finally
Me.Cursor = Cursors.Default
End Try
End Sub Private Sub printDocGraph_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printDocGraph.PrintPage
Dim gg As New Bitmap(tmpGraphFile)
e.Graphics.DrawImage(gg, 10, 20, e.PageBounds.Width - 50, e.MarginBounds.Height - 20)
gg.Dispose()
End Sub