|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Print margins not workingWhen I run a print operation in my program (Microsoft VB.Net Form) I have some code that sets the print margins so that it leaves a nice gap, however, these gaps do not work. No matter what I set the margins to, the printer (HP Color Laserjet) always prints the same (top left corner with about a 5mm gap). Please Help. Here's my code (the landscape bit works by the way): Private Sub MenuPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuPrint.Click Dim result As DialogResult PrintDialog1.AllowSomePages = True PrintDialog1.ShowHelp = True PrintDialog1.Document = PrintDocument1 result = PrintDialog1.ShowDialog() If (result = DialogResult.OK ) Then CaptureScreen() With PrintDocument1 With .DefaultPageSettings .Landscape = True .Margins.Left = 100 .Margins.Top = 100 .Margins.Right = 100 .Margins.Bottom = 100 End With .Print() End With End If End Sub Cheers. It's quite common to mix up the role of
PrinterSettings.DefaultPageSettings and PrintDocument.DefaultPageSettings. You have to copy each setting of ..PrinterSettings.DefaultPageSettings over PrintDocument.DefaultPageSettings or set directly the last one. -tom scrawnyg***@gmail.com ha scritto: Show quoteHide quote > There's probably something easy I'm missing here. > > When I run a print operation in my program (Microsoft VB.Net Form) I > have some code that sets the print margins so that it leaves a nice > gap, however, these gaps do not work. No matter what I set the margins > to, the printer (HP Color Laserjet) always prints the same (top left > corner with about a 5mm gap). > > Please Help. > > Here's my code (the landscape bit works by the way): > > Private Sub MenuPrint_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MenuPrint.Click > Dim result As DialogResult > > PrintDialog1.AllowSomePages = True > PrintDialog1.ShowHelp = True > PrintDialog1.Document = PrintDocument1 > result = PrintDialog1.ShowDialog() > If (result = DialogResult.OK ) Then > CaptureScreen() > With PrintDocument1 > With .DefaultPageSettings > .Landscape = True > .Margins.Left = 100 > .Margins.Top = 100 > .Margins.Right = 100 > .Margins.Bottom = 100 > End With > .Print() > End With > End If > End Sub > > Cheers.
a vb.net equivalent to the sql IN function?
Function versus ReadOnly Property VB.NET Threading CPU Issue Memory Manipulation Help using multiple languages Opening a new window Unmanaged C++ Void* Use HideDragon to Quick hide window, the best Boss key! File Name Validator Create a TreeView to display content like Explorer |
|||||||||||||||||||||||