473,795 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling PageSetupDialog from a PrintPreviewDia log

I customized a PrintPreviewDia log by adding a button to it's toolstrip
that opens up a PageSetupDialog . The problem is changes made to the
page setup are not passed to the PrintPreviewDia log until I close and
reload it.
How do I enable these changes to immediately show up in the print
preview. See Code Below.

Paul

Private Sub ToolStripMenuIt em2_Click(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles ToolStripMenuIt em2.Click
Dim dlgPrintPreview As New PrintPreviewDia log
Dim PageSetButton As New ToolStripButton

PageSetButton.T oolTipText = "Page Setup"
PageSetButton.T ext = "Setup"
tb = DirectCast(dlgP rintPreview.Con trols(1), ToolStrip)
For i As Integer = 4 To 7
' tbt = tb.Items(i)
' tbt.Visible = False
tb.Items.Remove At(i)
Next
AddHandler PageSetButton.C lick, AddressOf PageSetup
tb.Items.Add(Pa geSetButton)
dlgPrintPreview .Document = PrintDoc
dlgPrintPreview .ShowDialog()
End Sub

Private Sub PageSetup(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles ToolStripMenuIt em1.Click
Try
' show page setup dialog
Dim pageSetupDialog As PageSetupDialog = New
PageSetupDialog ()

pageSetupDialog .PrinterSetting s = PrintDoc.Printe rSettings
pageSetupDialog .PageSettings =
PrintDoc.Defaul tPageSettings

If pageSetupDialog .ShowDialog() =
Windows.Forms.D ialogResult.Can cel Then
Return
End If

' save changes
PrintDoc.Printe rSettings = pageSetupDialog .PrinterSetting s
PrintDoc.Defaul tPageSettings =
pageSetupDialog .PageSettings
Catch ex As Exception
MessageBox.Show (ex.Message)
End Try
End Sub

Apr 27 '07 #1
0 1890

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
14452
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!
3
22980
by: sachin | last post by:
How to customize PrintPreviewDialog, such that, addition of a new button, change the functionality of existing button should be possible programatically. Sample code will help a lot. Moreover, what happens before the document gets displayed in PrintPreviewDialog, i.e. whether entire document gets copied in printer driver spool or only 1 or 2 pages? please guide regards
0
1597
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;
6
3275
by: Just Me | last post by:
Dim PageSetupDialog As New PageSetupDialog With PageSetupDialog ..Document = mPD ....snip
0
1046
by: Just Me | last post by:
I do the code at the bottom of this, and later use: zz = mPD.DefaultPageSettings.PaperSize.Height and it works most of the time. It's a long story but if I use the printer's "Custom" size I do not always get the correct results. Expertimenting isn't getting me anywhere I need someone who understands the mPD options! I know I can also get page size by zz = mpD.PrinterSettings.DefaultPageSettings.PaperSize.Height
2
4894
by: Amjad | last post by:
I use the PageSetupDialog box to allow the user to change the page margins before printing. The problem is when I open the dialog box and type in margin values in millimeters (as it says in the group border title), click on the OK button, and then open the dialog box again, I find that all the margin values were divided by 2.54. Basically, every time I open that Dialog box and click on OK, all the margin values get divided by 2.54. I...
1
2618
by: Blaine | last post by:
When I show my Windows Form as a dialog box (ShowDialog(Me)) and click on a button that calls the ShowDialog of either the PageSetupDialog or PrintDialog conrtol, my Windows Form closes After I close the PageSetupDialog or PrintDialog. This doesn't happen if the Windows Form is displayed using the Show method. Does anyone have a solution? I've made my own Print Setup Dialog Box (frmPrint). I've added the PrintDocument, PageSetupDialog...
2
9876
by: Richard MSL | last post by:
I am using PrintPreviewDialog to preview a file. There is a button that the user can press, which seems to print the file to the default printer. I would like to capture a click on that button so that I can present a PrintDialog, print some files in a special way, etc. But there does not seem to be an event among the PrintPreviewDialog members to do this? Or perhaps I missed it? I would appreciate any suggestions. Thanks.
0
1133
by: ywscr | last post by:
Hello, I am using PageSetupDialog in my application to change the pagesettings of the document,I changed PaperSize To "A4" in PageSetupDialog ,But it's result PaperSize no change ??I want Set PaperSize in PageSetupDialog And result OK; source code: private void button2_Click(object sender, EventArgs e) { pd = new PrintDocument(); PageSetupDialog mPS = new PageSetupDialog(); foreach...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10439
Oralloy
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...
0
10215
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10001
tracyyun
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...
1
7541
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
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...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.