473,395 Members | 2,437 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,395 software developers and data experts.

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.PrintParameters.PrintDocument()
PageSetupDialog.Document = pd
If PageSetupDialog.ShowDialog = DialogResult.OK Then
MsgBox (PageSetupDialog.PageSettings.Margins)
End If

Any help is appreciated
Nov 21 '05 #1
2 4857
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.PrintParameters.PrintDocument()
PageSetupDialog.Document = pd
If PageSetupDialog.ShowDialog = DialogResult.OK Then
MsgBox (PageSetupDialog.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.printDocument;
Margins originalMargins = psd.Document.DefaultPageSettings.Margins;

if(System.Globalization.RegionInfo.CurrentRegion.I sMetric)
{
psd.Document.DefaultPageSettings.Margins = PrinterUnitConvert.Convert(psd.
Document.DefaultPageSettings.Margins, PrinterUnit.Display, PrinterUnit.
TenthsOfAMillimeter);
}
DialogResult result = psd.ShowDialog();
if ( result != DialogResult.OK)
{
psd.Document.DefaultPageSettings.Margins = originalMargins;
}
}
Jan 15 '06 #3

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

Similar topics

0
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, _...
6
by: Just Me | last post by:
Dim PageSetupDialog As New PageSetupDialog With PageSetupDialog ..Document = mPD ....snip
0
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...
1
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...
1
by: Dennis | last post by:
I am trying to use the PageSetUpDialog and set some defaults before it shows; PageSetUpDialog1.Document.DefaultPageSettings.Landscape =True...
1
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...
1
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...
0
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...
0
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
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...
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,...

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.