|
-
Apr 8th, 2008, 09:59 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2008]How can I prevent from the user to print from PrintPreviewDialog
Hi,
I am using the code below:
Code:
Dim PPD As New PrintPreviewDialog
PPD.WindowState = FormWindowState.Maximized
PPD.Document = PrintDocument1
PPD.ShowDialog()
When the PrintPreviewDialog show the Document, the user can print the Document.
How can I prevent from the user to print from PrintPreviewDialog?
-
Apr 8th, 2008, 10:02 AM
#2
Re: [2008]How can I prevent from the user to print from PrintPreviewDialog
This is a bit confusing.
You are presenting the print preview dialog to the user, but you don't want the user to use it - is that what is happening here?
If so, then why are you displaying it in the first place? What is it that you do want the user to do?
-
Apr 8th, 2008, 10:11 AM
#3
Thread Starter
Addicted Member
Re: [2008]How can I prevent from the user to print from PrintPreviewDialog
Hi,
I want that the user will print from another place (button), because the program needs to save some data before printing.
-
Apr 8th, 2008, 10:43 AM
#4
Re: [2008]How can I prevent from the user to print from PrintPreviewDialog
The PrintPreviewDialog control contains a ToolStrip which has the printToolStripButton among other ToolStripItems. So what you need to do is to get a reference to the printToolStripButton and set its enable property to false prior to showing the printpreviewdialog. Something like this
Code:
For Each ctrl As Control In PrintPreviewDialog1.Controls
If TypeOf ctrl Is ToolStrip Then
For Each item As ToolStripItem In DirectCast(ctrl, ToolStrip).Items
If item.Name = "printToolStripButton" Then
item.Enabled = False
End If
Next
End If
Next
PrintPreviewDialog1.Show()
-
Apr 8th, 2008, 10:58 AM
#5
Thread Starter
Addicted Member
Re: [2008]How can I prevent from the user to print from PrintPreviewDialog
Hi,
Great Great Great !!!
Thank you very much
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|