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



The information in this article applies to:

  • Microsoft .NET Framework 1.0 SP2
  • Microsoft .NET Framework 1.0 SP1
  • 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:Note If you do not want to upgrade to the .NET Framework 1.1, use the method that is described in the "Resolution" 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:

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: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 "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

To create a Microsoft Windows form by using Microsoft Visual Basic .NET, follow these steps:
  1. Start Microsoft Visual Studio .NET.
  2. On the File menu, point to New, and then click Project.
  3. In the Project Types section, click Visual Basic Projects.
  4. In the Templates section, click Windows Application.
  5. In the Name box, type Q830730, and then click OK.

    By default, the form that is named Form1.vb is created.
  6. On the View menu, click Code.
  7. Replace all the existing code in Form1.vb with the following code:
    Imports System.Drawing.Printing
    Public Class Form1
        Inherits System.Windows.Forms.Form
    
    #Region " Windows Form Designer generated code "
    
        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 = "Button1"
            Me.Button1.Size = New System.Drawing.Size(224, 64)
            Me.Button1.TabIndex = 0
            Me.Button1.Text = "Print test"
            '
            '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 = "Form1"
            Me.Text = "Form1"
            Me.ResumeLayout(False)
    
        End Sub
    
    #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("Test Print", Me.Font, Brushes.Black, 10, 10)
    
            e.HasMorePages = False
        End Sub
    End Class
  8. On the Build menu, click Build Solution.
  9. On the Debug menu, click Start.

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

    This is "Form1.vb" that you created in step 5 in the previous set of steps.
  2. Set Zoom to 200% or to 50%.

    Note This operation may be different, depending on your printer.
  3. 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 "Symptoms" section.

REFERENCES

For additional information about the System.Windows.Forms.PrintDialog class, visit the following MSDN Web site:

Modification Type:MinorLast Reviewed:10/25/2005
Keywords:kbHotfixServer kbQFE kbprint kbNetFrame100SP2fix kbQFE kbfix KB830730 kbAudDeveloper