Microsoft KB Archive/830730

= FIX: The Zoom option of the System.Windows.Forms.PrintDialog class does not work in the Microsoft .NET Framework 1.0 =

Article ID: 830730

Article Last Modified on 5/11/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.0 Service Pack 2
 * Microsoft .NET Framework 1.0 Service Pack 1
 * Microsoft .NET Framework 1.0

-





SYMPTOMS
When you try to print a page in an application that is created in the Microsoft .NET Framework 1.0, the Zoom option does not work.



CAUSE
This problem occurs because of a bug in the System.Windows.Forms.PrintDialog class in the .NET Framework 1.0.



WORKAROUND
To work around this problem, you can upgrade to the .NET Framework 1.1 and then recompile your application in the .NET Framework 1.1.

To download the .NET Framework 1.1, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/netframework/aa569264.aspx

Note If you do not want to upgrade to the .NET Framework 1.1, use the method that is described in the &quot;Resolution&quot; section.



RESOLUTION
Note Before you apply this hotfix, you have to upgrade to the .NET Framework 1.0 Service Pack 2.

To download the .NET Framework 1.0 Service Pack 2, visit the following MSDN Web site:

http://msdn2.microsoft.com/en-us/netframework/aa569276.aspx

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

  Date         Time   Version            Size    File name --  21-Oct-2003  03:15  1.0.3705.463      462,848  System.drawing.dll



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 problem
To create a Microsoft Windows form by using Microsoft Visual Basic .NET, follow these steps:  Start Microsoft Visual Studio .NET. On the File menu, point to New, and then click Project. In the Project Types section, click Visual Basic Projects. In the Templates section, click Windows Application.</li> In the Name box, type Q830730, and then click OK.

By default, the form that is named Form1.vb is created.</li> On the View menu, click Code.</li>  Replace all the existing code in Form1.vb with the following code:

Imports System.Drawing.Printing Public Class Form1 Inherits System.Windows.Forms.Form


 * 1) Region &quot; Windows Form Designer generated code &quot;

Public Sub New MyBase.New

'This call is required by the Windows Form Designer. InitializeComponent

'Add any initialization after the InitializeComponent call.

End Sub

'The form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose End If       End If        MyBase.Dispose(disposing) End Sub

'Required by the Windows Form Designer. Private components As System.ComponentModel.IContainer

'The following procedure is required by the Windows Form Designer. 'The following procedure can be modified by using the Windows Form Designer. 'Do not modify the following procedure by using the code editor. Friend WithEvents Button1 As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough> Private Sub InitializeComponent Me.Button1 = New System.Windows.Forms.Button Me.SuspendLayout '       'Button1 '       Me.Button1.Location = New System.Drawing.Point(32, 80) Me.Button1.Name = &quot;Button1&quot; Me.Button1.Size = New System.Drawing.Size(224, 64) Me.Button1.TabIndex = 0 Me.Button1.Text = &quot;Print test&quot; '       'Form1 '       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(292, 270) Me.Controls.Add(Me.Button1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.Name = &quot;Form1&quot; Me.Text = &quot;Form1&quot; Me.ResumeLayout(False)

End Sub


 * 1) End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim pd As New PrintDocument

Dim dlgPrint As New PrintDialog dlgPrint.PrinterSettings = Nothing

If dlgPrint.ShowDialog = DialogResult.OK Then AddHandler pd.PrintPage, AddressOf PrintPage

pd.PrinterSettings = dlgPrint.PrinterSettings

pd.Print End If   End Sub Private Sub PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs) e.Graphics.DrawString(&quot;Test Print&quot;, Me.Font, Brushes.Black, 10, 10)

e.HasMorePages = False End Sub End Class </li> On the Build menu, click Build Solution.</li> On the Debug menu, click Start.

Form1.vb starts.</li></ol>

To perform a print test, follow these steps:
 * 1) On Form1.vb, click Print test.

This is &quot;Form1.vb&quot; that you created in step 5 in the previous set of steps.
 * 1) Set Zoom to 200% or to 50%.

Note This operation may be different, depending on your printer.
 * 1) Print a test page.

You expect the test page to appear with a 200% zoom or a 50% zoom. However, the problem occurs that is mentioned in the &quot;Symptoms&quot; section.

<div class="references_section">