GrapeCity MultiRow Windows Forms Documentation
ZoomFactor Property (PrintSettings)
Example 


Gets or sets a value that indicates the zoom ratio when printing GcMultiRow to a Graphics object.
Syntax
<SRDescriptionAttribute("Indicates the zoom factor when printing.")>
<DefaultValueAttribute()>
<RefreshPropertiesAttribute(RefreshProperties.Repaint)>
Public Property ZoomFactor As Single
Dim instance As PrintSettings
Dim value As Single
 
instance.ZoomFactor = value
 
value = instance.ZoomFactor
[SRDescription("Indicates the zoom factor when printing.")]
[DefaultValue()]
[RefreshProperties(RefreshProperties.Repaint)]
public float ZoomFactor {get; set;}

Property Value

A System.Single value that represents the zoom ratio when printing GcMultiRow to a Graphics object. The default is 1f.
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeExceptionWhen the assigned value is less than 0.1f or greater than 4f.
Remarks

The print zoom keeps the aspect ratio.

The zoom ratio's range is between 0.1 and 4.

If the Template is so wide that one page cannot display 0.1 times the width completely, the excess part is printed next to the new page by default. You can control whether to print the excess part next to the new page or clip it with the HorizontalPageBreak property.

Example
The following code example shows how to use the PrintStyle.Compact style and the PagingMode.Flow option to print the GcMultiRow control. You can control the print zoom ratio by setting the ZoomFactor property. This example is part of a larger example available for the GcMultiRow.PrintSettings class.
void setCompactAndZoomFactorButton_Click(object sender, EventArgs e)
        {
            Template template1 = CreateTemplate(2, 21);
            AddPrintInfoCellColumnFooterSection(template1, 21);
            this.gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 20;

            //Some UI elements are not printed, like UpDown button.
            gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Compact;
            gcMultiRow1.PrintSettings.PagingMode = PagingMode.Flow;
            gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleCenter;
            gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.AllRows;
            if (flag)
            {
                //The Template is printed to the page with the zoom ratio 3.
                gcMultiRow1.PrintSettings.ZoomFactor = 3f;
                flag = false;
            }
            else
            {
                gcMultiRow1.PrintSettings.ZoomFactor = 1f;
                flag = true;
            }
            gcMultiRow1.PrintSettings.AutoFitWidth = false;
            try
            {
                gcMultiRow1.PrintPreview();
                //If you have a printer, you can execute the following code directly instead.
                //gcMultiRow1.Print(true);
            }
            catch (Exception ex)
            {
                // Can't find printer driver.
                MessageBox.Show(ex.Message);
            }
            label.Text = "The Compact style will not print some UI elements, like UpDown button; Click the button again to view how the ZoomFactor property takes effect.";
        }
Private Sub setCompactAndZoomFactorButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setCompactAndZoomFactorButton.Click
        Dim template1 As Template = CreateTemplate(2, 21)
        AddPrintInfoCellColumnFooterSection(template1, 21)
        Me.gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 20

        'Some UI elements are not printed, like UpDown button.
        gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Compact
        gcMultiRow1.PrintSettings.PagingMode = PagingMode.Flow
        gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleCenter
        gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.AllRows
        If flag Then
            'The Template is printed to the page with the zoom ratio 3.
            gcMultiRow1.PrintSettings.ZoomFactor = 3.0F
            flag = False
        Else
            gcMultiRow1.PrintSettings.ZoomFactor = 1.0F
            flag = True
        End If
        gcMultiRow1.PrintSettings.AutoFitWidth = False
        Try
            'If you have a printer, you can execute the following code directly instead.
            'gcMultiRow1.Print(true);
            gcMultiRow1.PrintPreview()
        Catch ex As Exception
            ' Can't find printer driver.
            MessageBox.Show(ex.Message)
        End Try
        label.Text = "The Compact style will not print some UI elements, like UpDown button; Click the button again to view how the ZoomFactor property takes effect."
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PrintSettings Class
PrintSettings Members
AutoFitWidth Property
HorizontalPageBreak Property

 

 


Copyright © GrapeCity, inc. All rights reserved.