Microsoft KB Archive/814355

= BUG: The margin value decreases every time PageSetupDialog is displayed =

Article ID: 814355

Article Last Modified on 5/11/2007

-

APPLIES TO


 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-





SYMPTOMS
The PageSetupDialog control reduces the margin every time it is displayed when you do the following things:
 * Set the Measurement System property of the Regional and Language Options of your computer to Metric.

-and-


 * Use the PageSetupDialog control.



CAUSE
If the default measurement system is U.S., the PageSetupDialog box uses thousandths of inches as the default unit of measurement. If the default measurement system is Metric, the dialog box uses hundredths of millimeters as the default unit of measurement. By default, U.S. is the measurement system. If the measurement system is Metric, the margins are converted from U.S. system to Metric system. When the PageSetupDialog is closed, the computer saves information about the page size. When the PageSetupDialog is reopened, the computer incorrectly assumes the margin as if it was a U.S. system margin instead of a Metric system margin. The computer converts the margin to the Metric system again. Therefore, the margin reduces every time the PageSetupDialog is displayed.



WORKAROUND
To work around this bug, you can use the U.S. settings for the Measurement system property of the Regional and Language Options. To do this, follow these steps:
 * 1) On the taskbar, click Start. Point to Settings, and then click Control Panel.
 * 2) Click Regional and Language Options.
 * 3) On the Regional Options tab, click Customize.
 * 4) Set U.S. as the Measurement System property.
 * 5) Click OK to save the settings.
 * 6) Click OK in the Regional and Language Options window.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the behavior
 On the taskbar, click Start. Point to Settings, and then click Control Panel. Click Regional and Language Options. On the Regional Options tab, click Customize. Set the Measurement System property to Metric. Click OK in the Customize Regional Options window.</li> Click OK in the Regional and Language Options window.</li> Create a new Windows application by using Microsoft Visual C# .NET or Microsoft Visual Basic .NET.</li> From the toolbox, drag a Button control to the form.</li> From the toolbox, drag a PrintDocument control to the form.</li> From the toolbox, drag a PageSetupDialog control to the form.</li> Right-click PageSetUpDialog, and then click Properties.</li> Set the Document property to PrintDocument1 .</li>  Double-click Button, and then add the following code in the Button1_Click event:

Visual Basic .NET Code PageSetupDialog1.ShowDialog

Visual C# .NET Code pageSetupDialog1.ShowDialog; </li> On the Debug menu, click Start to run the application.</li> Click Button.

PageSetUpDialog is displayed.</li> All the margins are set to 10.</li> Click OK.</li> Click Button again.

All the margins are set to 3.9.</li></ol>

<div class="references_section">