Connecting Tech Pros Worldwide Forums | Help | Site Map

PageSetupDialog bug!

Amjad
Guest
 
Posts: n/a
#1: Nov 21 '05
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

Amjad
Guest
 
Posts: n/a
#2: Nov 21 '05

re: PageSetupDialog bug!


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:
[color=blue]
> 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[/color]
Carlos Barrera
Guest
 
Posts: n/a
#3: Jan 15 '06

re: PageSetupDialog bug!


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;
}
}
Closed Thread


Similar Visual Basic .NET bytes