Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PrintPreviewControl.UseAntiAlias Property

Gets or sets a value indicating whether printing uses the anti-aliasing features of the operating system.

[Visual Basic]
Public Property UseAntiAlias As Boolean
[C#]
public bool UseAntiAlias {get; set;}
[C++]
public: __property bool get_UseAntiAlias();
public: __property void set_UseAntiAlias(bool);
[JScript]
public function get UseAntiAlias() : Boolean;
public function set UseAntiAlias(Boolean);

Property Value

true if anti-aliasing is used; otherwise, false.

Remarks

Anti-aliasing removes jagged lines when fonts are rendered.

Example

[Visual Basic, C#] The following code example demonstrates the UseAntiAlias property. To run this example place the following code in a form and call the InitializePrintPreviewControl method from the forms constructor or Load method.

[Visual Basic] 


    'Declare the PrintPreviewControl object and the PrintDocument object.
    Friend WithEvents PrintPreviewControl1 As PrintPreviewControl
    Private WithEvents docToPrint As New Printing.PrintDocument

    Private Sub InitializePrintPreviewControl()

        ' Construct the PrintPreviewControl.
        Me.PrintPreviewControl1 = New PrintPreviewControl

        ' Set location, name, and dock style for PrintPreviewControl1.
        Me.PrintPreviewControl1.Location = New Point(88, 80)
        Me.PrintPreviewControl1.Name = "PrintPreviewControl1"
        Me.PrintPreviewControl1.Dock = DockStyle.Fill

        ' Set the Document property to the PrintDocument 
        ' for which the PrintPage event has been handled.
        Me.PrintPreviewControl1.Document = docToPrint

        ' Set the zoom to 25 percent.
        Me.PrintPreviewControl1.Zoom = 0.25

        ' Set the document name. This will show be displayed when 
        ' the document is loading into the control.
        Me.PrintPreviewControl1.Document.DocumentName = "c:\someFile"

        ' Set the UseAntiAlias property to true so fonts are smoothed
        ' by the operating system.
        Me.PrintPreviewControl1.UseAntiAlias = True

        ' Add the control to the form.
        Me.Controls.Add(Me.PrintPreviewControl1)
    End Sub

    ' The PrintPreviewControl will display the document
    ' by handling the documents PrintPage event
    Private Sub docToPrint_PrintPage(ByVal sender As Object, _
       ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
           Handles docToPrint.PrintPage

        ' Insert code to render the page here.
        ' This code will be called when the control is drawn.

        ' The following code will render a simple
        ' message on the document in the control.
        Dim text As String = "In docToPrint_PrintPage method."
        Dim printFont As New Font _
            ("Arial", 35, System.Drawing.FontStyle.Regular)

        e.Graphics.DrawString(text, printFont, _
            System.Drawing.Brushes.Black, 10, 10)
    End Sub

[C#] 

    // Declare the PrintPreviewControl object and the 
    // PrintDocument object.
    internal PrintPreviewControl PrintPreviewControl1;
    private System.Drawing.Printing.PrintDocument docToPrint = 
        new System.Drawing.Printing.PrintDocument();

    private void InitializePrintPreviewControl()
    {

        // Construct the PrintPreviewControl.
        this.PrintPreviewControl1 = new PrintPreviewControl();

        // Set location, name, and dock style for PrintPreviewControl1.
        this.PrintPreviewControl1.Location = new Point(88, 80);
        this.PrintPreviewControl1.Name = "PrintPreviewControl1";
        this.PrintPreviewControl1.Dock = DockStyle.Fill;

        // Set the Document property to the PrintDocument 
        // for which the PrintPage event has been handled.
        this.PrintPreviewControl1.Document = docToPrint;

        // Set the zoom to 25 percent.
        this.PrintPreviewControl1.Zoom = 0.25;

        // Set the document name. This will show be displayed when 
        // the document is loading into the control.
        this.PrintPreviewControl1.Document.DocumentName = "c:\\someFile";

        // Set the UseAntiAlias property to true so fonts are smoothed
        // by the operating system.
        this.PrintPreviewControl1.UseAntiAlias = true;

        // Add the control to the form.
        this.Controls.Add(this.PrintPreviewControl1);
        
        // Associate the event-handling method with the
        // document's PrintPage event.
        this.docToPrint.PrintPage += 
            new System.Drawing.Printing.PrintPageEventHandler(
            docToPrint_PrintPage);
    }

    // The PrintPreviewControl will display the document
    // by handling the documents PrintPage event
    private void docToPrint_PrintPage(
        object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {

        // Insert code to render the page here.
        // This code will be called when the control is drawn.

        // The following code will render a simple
        // message on the document in the control.
        string text = "In docToPrint_PrintPage method.";
        System.Drawing.Font printFont = 
            new Font("Arial", 35, FontStyle.Regular);

        e.Graphics.DrawString(text, printFont,
            Brushes.Black, 10, 10);
    }

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

PrintPreviewControl Class | PrintPreviewControl Members | System.Windows.Forms Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft