...
Option Strict On
Imports System.Drawing.Printing
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With Me.PrintForm1
.PrintAction = Printing.PrintAction.PrintToPreview
For i = 0 To .PrinterSettings.PaperSizes.Count - 1
If .PrinterSettings.PaperSizes(i).Kind = PaperKind.A4 Then
Dim size As PaperSize = .PrinterSettings.PaperSizes(i)
.PrinterSettings.DefaultPageSettings.PaperSize = size
Exit For
End If
Next
Dim MyMargins As New Margins
With MyMargins
.Left = 0
.Right = 0
.Top = 0
.Bottom = 0
End With
.PrinterSettings.DefaultPageSettings.Margins = MyMargins
.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.CompatibleModeFullWindow)
End With
End Sub
End Class
Sunday, August 23, 2009
How to set the Print Margins?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment