GrapeCity MultiRow Windows Forms Documentation
PrintSettings Property
Example 


Gets the settings when printing.
Syntax
<SRCategoryAttribute("Behavior")>
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)>
<SRDescriptionAttribute("Indicates the relative settings for printing.")>
Public ReadOnly Property PrintSettings As PrintSettings
Dim instance As GcMultiRow
Dim value As PrintSettings
 
value = instance.PrintSettings
[SRCategory("Behavior")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[SRDescription("Indicates the relative settings for printing.")]
public PrintSettings PrintSettings {get;}

Property Value

A PrintSettings value that represents the settings when printing.
Remarks

You can print the GcMultiRow control to a Graphics object and you can customize the print settings. If you want to use a different paging style, set the PrintSettings.PagingMode property. Use the MultiRowPrintRange.SomeRows option of the PrintSettings.PrintRange property if you want to choose which rows to print. You can also select a row's range with PrintSettings.FromRow and PrintSettings.ToRow. Use the PrintSettings.SectionMargin property to set margins between two rows. The PrintSettings.ColumnMargin property can be used to specify the margin between two columns when PrintSettings.PagingMode is PagingMode.MultiColumns.

You can specify how to print ColumnHeaderSection and ColumnFooterSection in each page with the PrintSettings.PrintHeader or PrintSettings.PrintFooter property.

When the Template's width is less than or greater than the page's width, you can use the PrintSettings.AutoFitWidth setting to control whether to automatically fit the Template's width to the page's width. If you want to print the GcMultiRow control to a page with a zoom ratio, set the PrintSettings.ZoomFactor property.

The settings are used by Print, Print(Boolean), PrintPreview, PrintPreview(Int32), and Document.

Example
The following code example shows how to print GcMultiRow. Before printing the GcMultiRow control, set some PrintSettings, then execute the PrintPreview to preview the effect, or execute the Print to print directly to a printer. You can use this property to set different PrintSettings.PrintStyles and different PrintSettings.PagingModes.
private void Form1_Load(object sender, EventArgs e)
        {
            gcMultiRow1.Template = CreateTemplate(3, 21);
            gcMultiRow1.RowCount = 5;
        }

        
        void setRichAndFlowButton_Click(object sender, EventArgs e)
        {
            Template template1 = CreateTemplate(3, 21);
            AddPrintInfoCellColumnFooterSection(template1, 21);
            this.gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 50;

            //All UI elements are printed, like UpDown button.
            gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich;
            //All Rows are printed from the first page to the last page, one by one.
            gcMultiRow1.PrintSettings.PagingMode = PagingMode.Flow;
            //The GcMultiRow is aligned by MiddleLeft.
            gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleLeft;
            //Between every two Rows, there are 15 pixels.
            gcMultiRow1.PrintSettings.SectionMargin = 15;
            //Only the Row from 2th to 8th are printed
            gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.SomeRows;
            gcMultiRow1.PrintSettings.FromRow = 2;
            gcMultiRow1.PrintSettings.ToRow = 8;

            if (flag)
            {
                //The Template's width is less than the page's width, set AutoFitWidth to true, the Template is zoomed out to 
// fit the page's width.
                gcMultiRow1.PrintSettings.AutoFitWidth = true;
                flag = false;
            }
            else
            {
                gcMultiRow1.PrintSettings.AutoFitWidth = false;
                flag = true;
            }
            gcMultiRow1.PrintSettings.ZoomFactor = 1f;
            try
            {
                gcMultiRow1.PrintPreview();
                //If you have a printer, execute the following code directly instead.
                //gcMultiRow1.Print(true);
            }
            catch (Exception ex)
            {
                // Can't find printer driver.
                MessageBox.Show(ex.Message);
            }
            label.Text = "In Rich style, all elements are printed, like UpDown button; Between two rows, 15 pixels exist; 
Only  the 2th to 8th row are printed one by one from page's Top to Bottom; The GcMultiRow is aligned by MiddleLeft; 
(Click the button again to view the AutoFitWidth property's effect)";
        }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        gcMultiRow1.Template = CreateTemplate(3, 21)
        gcMultiRow1.RowCount = 5
    End Sub

    Private Sub setRichAndFlowButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles 
setRichAndFlowButton.Click
        Dim template1 As Template = CreateTemplate(3, 21)
        AddPrintInfoCellColumnFooterSection(template1, 21)
        Me.gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 50

        'All UI elements are printed, like UpDown button.
        gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich
        'All Rows are printed from the first page to the last page, one by one.
        gcMultiRow1.PrintSettings.PagingMode = PagingMode.Flow
        'The GcMultiRow is aligned by MiddleLeft.
        gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleLeft
        'Between every two Rows, there are 15 pixels.
        gcMultiRow1.PrintSettings.SectionMargin = 15
        'Only the Row from 2th to 8th are printed
        gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.SomeRows
        gcMultiRow1.PrintSettings.FromRow = 2
        gcMultiRow1.PrintSettings.ToRow = 8

        If flag Then
            'The Template's width is less than the page's width, set AutoFitWidth to true, the Template is zoomed out to fit 
the page's width.
            gcMultiRow1.PrintSettings.AutoFitWidth = True
            flag = False
        Else
            gcMultiRow1.PrintSettings.AutoFitWidth = False
            flag = True
        End If
        gcMultiRow1.PrintSettings.ZoomFactor = 1.0F
        Try
            'If you have a printer, 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 = "In Rich style, all elements are printed, like UpDown button; Between two rows, 15 pixels exist; Only  
the 2th to 8th row are printed one by one from page's Top to Bottom; The GcMultiRow is aligned by MiddleLeft; (Click 
the button again to view the AutoFitWidth property's 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

GcMultiRow Class
GcMultiRow Members
Print Method
PrintPreview Method
PageSetup Method
Document Property

 

 


Copyright © GrapeCity, inc. All rights reserved.