473,804 Members | 3,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PageSetupDialog bug!

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 know that this is a metric-imperial unit problem, but I don't know how to
fix it. I have used the following code to open the dialog box:

Dim pd As PrintDocument = C1grd.PrintPara meters.PrintDoc ument()
PageSetupDialog .Document = pd
If PageSetupDialog .ShowDialog = DialogResult.OK Then
MsgBox (PageSetupDialo g.PageSettings. Margins)
End If

Any help is appreciated
Nov 21 '05 #1
2 4900
It's a bug in the control as I thought. Check out what Microsoft says about it:

BUG: The Margin Value Decreases Every Time PageSetupDialog Is Displayed
http://support.microsoft.com/?id=814355
"Amjad" wrote:
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 know that this is a metric-imperial unit problem, but I don't know how to
fix it. I have used the following code to open the dialog box:

Dim pd As PrintDocument = C1grd.PrintPara meters.PrintDoc ument()
PageSetupDialog .Document = pd
If PageSetupDialog .ShowDialog = DialogResult.OK Then
MsgBox (PageSetupDialo g.PageSettings. Margins)
End If

Any help is appreciated

Nov 21 '05 #2
I solve it this way:

private void pageSetup( )
{
PageSetupDialog psd = new PageSetupDialog ( );
psd.Document = this.printDocum ent;
Margins originalMargins = psd.Document.De faultPageSettin gs.Margins;

if(System.Globa lization.Region Info.CurrentReg ion.IsMetric)
{
psd.Document.De faultPageSettin gs.Margins = PrinterUnitConv ert.Convert(psd .
Document.Defaul tPageSettings.M argins, PrinterUnit.Dis play, PrinterUnit.
TenthsOfAMillim eter);
}
DialogResult result = psd.ShowDialog( );
if ( result != DialogResult.OK )
{
psd.Document.De faultPageSettin gs.Margins = originalMargins ;
}
}
Jan 15 '06 #3

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

Similar topics

0
1179
by: Andy Sze | last post by:
Visual Studio.net 2003 no yet fix the PageSetupDialog bug. http://support.microsoft.com/?id=814355 Here is my new solution: Private Sub btnPageSetup_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnPageSetup.Click '--- If Microsoft fix the bug should be: 'PageSetupDialog1.PageSettings = PrintPageSettings
6
3276
by: Just Me | last post by:
Dim PageSetupDialog As New PageSetupDialog With PageSetupDialog ..Document = mPD ....snip
0
1051
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
1
2619
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...
1
1629
by: Dennis | last post by:
I am trying to use the PageSetUpDialog and set some defaults before it shows; PageSetUpDialog1.Document.DefaultPageSettings.Landscape =True PageSetUpDialog1.PrinterSettings.DefaultPageSettings.Landscape = True PageSetUpDialog1.ShowDialog However, the dialog shows the Portrait checked, not the landscape when it shows up. This is also the case when I try to set the default margins. Why does the dialog not show the defaults that I have...
1
3902
by: Ratan | last post by:
Hello, I am using PageSetupDialog in my application to change the pagesettings of the document but i dont want to show all the page size to the user, I want to show only A3 and A4 size for selection in papersize dropdown. Is it possible to customize this option?? /Ratan
1
4834
by: Ed Sutton | last post by:
My C# app. apparently has problems with PageSettings not being initialized properly after calling PageSetupDialog. If a user selects a non-default printer from PageSetupDialog, the PageSize is apparently not-initialized properly. It appears to be printing to a very small page size and only prints a small piece of each page. Alternatively, if if a user selects the new printer, then user selects the paper size from the printer properties,...
0
1895
by: ppeterkin | last post by:
I customized a PrintPreviewDialog 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 PrintPreviewDialog 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 ToolStripMenuItem2_Click(ByVal sender As System.Object,
0
1136
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
9708
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, 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...
0
9587
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
10588
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...
1
10324
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,...
0
9161
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, 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...
1
7623
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
6857
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();...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2998
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.