473,739 Members | 6,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you select a specific printer from the PrintPreviewDia log?

Is there anyway to hook the PrintDialog to the printer icon on the
PrintPreviewDia log?

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 5701

"Darrell Wesley" <Da***********@ discussions.mic rosoft.com> escribió en el
mensaje news:F6******** *************** ***********@mic rosoft.com...
Is there anyway to hook the PrintDialog to the printer icon on the
PrintPreviewDia log?

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
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 PrintPreviewDia log
Public PrvPrintFromMet afiles As Boolean

Private DirectPrint As Boolean
Private LastPage As Integer
Private WithEvents pdmf As PrintDocument
Private pageInfo As PreviewPageInfo ()
Protected Overrides Sub OnBeginPrint(By Val e As
System.Drawing. Printing.PrintE ventArgs)
'Si se pulsa el botón print desde PrintPreviewDia log, Selección
If IsPreview = False AndAlso DirectPrint = False Then
PrinterSettings .MinimumPage = 1
PrinterSettings .MaximumPage = LastPage
PrinterSettings .FromPage = Dlg.PrintPrevie wControl.StartP age + 1
If (New PageSel(Printer Settings)).Show Dialog(Dlg) =
DialogResult.Ca ncel Then e.Cancel = True : Exit Sub
If PrvPrintFromMet afiles AndAlso PrinterSettings .PrintRange =
PrintRange.Some Pages Then
Dim fi As FieldInfo =
GetType(PrintPr eviewControl).G etField("pageIn fo", BindingFlags.No nPublic Or
BindingFlags.In stance Or BindingFlags.Pu blic)
pageInfo = CType(fi.GetVal ue(Dlg.PrintPre viewControl), Object)
pdmf = New PrintDocument
pdmf.PrinterSet tings = PrinterSettings
Page = PrinterSettings .FromPage - 1
pdmf = Nothing
pageInfo = Nothing
e.Cancel = True
Exit Sub
End If
End If
MyBase.OnBeginP rint(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

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!
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 reference any one of them that might be selected. For instance, if I click Start, Control Panel, Printers and Faxes on a PC running XP and I see the following: HP Laser Jet 4200 PCL 6 HP Laser Jet 4200 PCL 5e HP Laser Jet III
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 blank page. If I comment out the printPreviewDialog1.ShowDialog(); and just do a printDocument1.Print(); instead, it prints all the pages like a champ. Anyone know what I'm doing wrong? Thanks
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. How can I fix this to print the text that is being displayed? Here is the code I use to bring up the form: string stringText = helpTextOut.Text;
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 Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ----------------------------------------------------------
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
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 lunching the printdialog (i.e. the user can't choose the print parameters). Thanks a lot.
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 change this setting so that by default the report will print to a specific printer that they select rather than the PC’s default printer? The reason for wanting to do this is that I don’t know the names of the printers they might have and the DB...
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 prints labels to a label printer (Datamax E-4203) via PrintDocument. The PrintDocument prints a new page for each label, so with 4 labels printed at once I have a 4-page document - sounds easy - is easy.
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.