GrapeCity MultiRow Windows Forms Documentation
PrintStyle Property
Example 


Gets or sets a value that indicates the print style.
Syntax
<RefreshPropertiesAttribute(RefreshProperties.Repaint)>
<DefaultValueAttribute()>
<SRDescriptionAttribute("Indicates the print style.")>
Public Property PrintStyle As PrintStyle
Dim instance As PrintSettings
Dim value As PrintStyle
 
instance.PrintStyle = value
 
value = instance.PrintStyle
[RefreshProperties(RefreshProperties.Repaint)]
[DefaultValue()]
[SRDescription("Indicates the print style.")]
public PrintStyle PrintStyle {get; set;}

Property Value

One of the PrintStyle values. The default is PrintStyle.Rich.
Exceptions
ExceptionDescription
System.ComponentModel.InvalidEnumArgumentExceptionThe specified value is not one of PrintStyle values.
Remarks

GcMultiRow supports three print styles. The print result is the same as the screen display with the PrintStyle.Rich style. With the PrintStyle.Compact style, the print result is simple; it does not print any computer elements, like the Windows Theme, Dropdown Button, and so on. Typically, the Compact style is used to print a professional bill. The PrintStyle.Content style only prints the content so any styles on the cell will not be printed, including the cell's border.

With the Compact style, the OwnerDraw in CellPainting and SectionPainting is not printed, and all Windows theme elements are printed as the Flat visual style.

Example
The following code example shows how to use the PrintStyle.Rich style and the PagingMode.Flow option to print the GcMultiRow control. This example is part of a larger example available for the GcMultiRow.PrintSettings class.
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 first page to 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 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, 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 = "In Rich style, all elements are printed, like UpDown button; Between two rows, 15 pixels space exists; 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 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 first page to 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 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, 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 = "In Rich style, all elements are printed, like UpDown button; Between two rows, 15 pixels space exists; 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

PrintSettings Class
PrintSettings Members

 

 


Copyright © GrapeCity, inc. All rights reserved.