471,578 Members | 1,299 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,578 software developers and data experts.

How do you select a specific printer from the PrintPreviewDialog?

Is there anyway to hook the PrintDialog to the printer icon on the
PrintPreviewDialog?

I know that you can print a document using the PrintDialog but it does not
allow previewing and the PrintPreview dialog does not allow you to select a
printer - is there a good and simple way to get around these problems.

My users would like to select a specific printer while looking at the
Preview window.
Nov 21 '05 #1
1 5488

"Darrell Wesley" <Da***********@discussions.microsoft.com> escribió en el
mensaje news:F6**********************************@microsof t.com...
Is there anyway to hook the PrintDialog to the printer icon on the
PrintPreviewDialog?

I know that you can print a document using the PrintDialog but it does not
allow previewing and the PrintPreview dialog does not allow you to select
a
printer - is there a good and simple way to get around these problems.

My users would like to select a specific printer while looking at the
Preview window.


Public Class PrintDoc
Inherits PrintDocument

Public IsPreview As Boolean
Public Dlg As PrintPreviewDialog
Public PrvPrintFromMetafiles As Boolean

Private DirectPrint As Boolean
Private LastPage As Integer
Private WithEvents pdmf As PrintDocument
Private pageInfo As PreviewPageInfo()
..........
Protected Overrides Sub OnBeginPrint(ByVal e As
System.Drawing.Printing.PrintEventArgs)
'Si se pulsa el botón print desde PrintPreviewDialog, Selección
páginas
If IsPreview = False AndAlso DirectPrint = False Then
PrinterSettings.MinimumPage = 1
PrinterSettings.MaximumPage = LastPage
PrinterSettings.FromPage = Dlg.PrintPreviewControl.StartPage + 1
If (New PageSel(PrinterSettings)).ShowDialog(Dlg) =
DialogResult.Cancel Then e.Cancel = True : Exit Sub
If PrvPrintFromMetafiles AndAlso PrinterSettings.PrintRange =
PrintRange.SomePages Then
Dim fi As FieldInfo =
GetType(PrintPreviewControl).GetField("pageInfo", BindingFlags.NonPublic Or
BindingFlags.Instance Or BindingFlags.Public)
pageInfo = CType(fi.GetValue(Dlg.PrintPreviewControl), Object)
pdmf = New PrintDocument
pdmf.PrinterSettings = PrinterSettings
Page = PrinterSettings.FromPage - 1
pdmf.Print()
pdmf = Nothing
pageInfo = Nothing
e.Cancel = True
Exit Sub
End If
End If
MyBase.OnBeginPrint(e)
Sustituye PageSel por PrintDialog...
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Michael A. Covington | last post: by
reply views Thread by Harry J. Smith | last post: by
2 posts views Thread by Lighting_dragon | last post: by
4 posts views Thread by Ian | last post: by
1 post views Thread by =?Utf-8?B?R2VvcmcgRmxlaXNjaGVy?= | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
1 post views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.