GrapeCity MultiRow Windows Forms Documentation
HorizontalPageBreak Property
Example 


Gets or sets a value that indicates whether to break the page horizontally when the Template's width is greater than the page's width.
Syntax
<RefreshPropertiesAttribute(RefreshProperties.Repaint)>
<SRDescriptionAttribute("Indicates whether to break the page when the Template's Width is larger than the page's width.")>
<DefaultValueAttribute()>
Public Property HorizontalPageBreak As Boolean
Dim instance As PrintSettings
Dim value As Boolean
 
instance.HorizontalPageBreak = value
 
value = instance.HorizontalPageBreak
[RefreshProperties(RefreshProperties.Repaint)]
[SRDescription("Indicates whether to break the page when the Template's Width is larger than the page's width.")]
[DefaultValue()]
public bool HorizontalPageBreak {get; set;}

Property Value

true if breaking the page horizontally; otherwise,false. The default is true.
Remarks
Set this property to true if you want to print the excess part next to the new page when the Template's width is greater than the page's width; otherwise, false.
Example
The following code example shows how to use the PrintStyle.Rich style and the PagingMode.SingleRow option to print the GcMultiRow control. If the HorizontalPageBreak is true and the Template's width is greater than the page's width, the excess part is printed to a new page. This example is part of a larger example available for the GcMultiRow.PrintSettings class.
void setRichAndSingleRowButton_Click(object sender, EventArgs e)
        {
            Template template1 = CreateTemplate(10, 100);
            AddPrintInfoCellColumnFooterSection(template1, 100);
            this.gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 5;

            //All elements are printed.
            gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich;
            //Only one Row is printed to one page. You can print ColumnHeader to each page by setting PrintHeader property to AllPages.
            gcMultiRow1.PrintSettings.PagingMode = PagingMode.SingleRow;
            //The GcMultiRow is aligned by MiddleCenter.
            gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleCenter;
            //All Rows are printed.
            gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.AllRows;
            //In each page, besides one Row, the ColumnHeader is printed in the page's head.
            gcMultiRow1.PrintSettings.PrintHeader = PrintHeader.AllPages;
            //In each page, besides one Row, the ColumnFooter is printed in the page's tail.
            gcMultiRow1.PrintSettings.PrintFooter = PrintFooter.AllPages;
            if (flag)
            {
                //If Template's width is greater than page's width, the excess is printed to a new page.
                gcMultiRow1.PrintSettings.HorizontalPageBreak = true;
                flag = false;
            }
            else
            {
                //If Template's width is greater than page's width, the excess is clipped.
                gcMultiRow1.PrintSettings.HorizontalPageBreak = false;
                flag = true;
            }
            gcMultiRow1.PrintSettings.AutoFitWidth = false;
            gcMultiRow1.PrintSettings.ZoomFactor = 1f;
            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 = "Each Row is printed in each page with the ColumnHeader; The GcMultiRow is aligned by MiddleCenter; The Template's width is greater than page's width, The HorizontalPageBreak controls whether the excess is printed to a new page.(Click the button again to change the HorizontalPageBreak's effect)";
        }
Private Sub setRichAndSingleRowButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setRichAndSingleRowButton.Click
        Dim template1 As Template = CreateTemplate(10, 100)
        AddPrintInfoCellColumnFooterSection(template1, 100)
        Me.gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 5

        'All elements are printed.
        gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich
        'Only one Row is printed to one page. You can print ColumnHeader to each page by setting PrintHeader property to AllPages.
        gcMultiRow1.PrintSettings.PagingMode = PagingMode.SingleRow
        'The GcMultiRow is aligned by MiddleCenter.
        gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleCenter
        'All Rows are printed.
        gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.AllRows
        'In each page, besides one Row, the ColumnHeader is printed in the page's head.
        gcMultiRow1.PrintSettings.PrintHeader = PrintHeader.AllPages
        'In each page, besides one Row, the ColumnFooter is printed in the page's tail.
        gcMultiRow1.PrintSettings.PrintFooter = PrintFooter.AllPages

        If flag Then
            'If Template's width is greater than page's width, the excess is printed to a new page.
            gcMultiRow1.PrintSettings.HorizontalPageBreak = True
            flag = False
        Else
            'If Template's width is greater than page's width, the excess is clipped.
            gcMultiRow1.PrintSettings.HorizontalPageBreak = False
            flag = True
        End If
        gcMultiRow1.PrintSettings.AutoFitWidth = False
        gcMultiRow1.PrintSettings.ZoomFactor = 1.0F
        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 = "Each Row is printed in each page with the ColumnHeader; The GcMultiRow is aligned by MiddleCenter; The Template's width is greater than page's width, The HorizontalPageBreak controls whether the excess is printed to a new page.(Click the button again to change the HorizontalPageBreak'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

PrintSettings Class
PrintSettings Members

 

 


Copyright © GrapeCity, inc. All rights reserved.