473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 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 5668

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael A. Covington | last post by:
By default, my PrintPreviewDialog is coming out too small. What is the best way to control its size and position? Ideally, I'd just like to maximize it. Thanks!
2
by: MLH | last post by:
I would like to allow users to set, as an application default, a specific printer to send reports to. I don't know how to bring up a list of valid print devices in A97, nor do I know how to...
2
by: Randy | last post by:
Hello all, I'm trying to print using PrintPreviewDialog. What's happening is that the PrintPreviewDialog shows the correct information to be printed, but when I click the print icon, it prints a...
0
by: Harry J. Smith | last post by:
I am using the PrintPreviewDialog Window Form from the Toolbox. It displays my RichTextBox contents correctly, but when I click on the Print icon on this form it prints one blank page and no text....
2
by: Lighting_dragon | last post by:
Hi. I try to get the printable area of the printer (Margins). I have used Defaultpagesettings.Printersettings.Margins.Top, .Left, .... But it didn't give the true values. Posted Via...
0
by: MARCHESE Roberto | last post by:
Hi, When the PrintPreviewDialog is appeared with many pages, I desire select only one page to print. Is possible to show a dialog for select the pages that I want to print. Many thanks for a reply
10
by: choupi | last post by:
Hello, Is there a way to call a printDialog from a printPreviewDialog (from print icon for example)? Indeed, the print icon in the printpreviewdialog prints directly the document without...
4
by: Ian | last post by:
I have an Access 97 database, on a Report I have the print option set to print to the PC’s default printer rather than a printer selected from the list. My question is: Can I allow the user to...
1
by: =?Utf-8?B?R2VvcmcgRmxlaXNjaGVy?= | last post by:
Hello, I've got a problem which I can not locate. I will try to describe it and would be glad, if someone had an idea how to identify the cause of the problem. Situation: My application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.