GrapeCity MultiRow Windows Forms Documentation
Printable Property (ColumnHeaderSection)
Example 


Gets or sets a value that indicates whether this ColumnHeaderSection is printable.
Syntax
<SRCategoryAttribute("Behavior")>
<LocalizableAttribute(True)>
<SRDescriptionAttribute("Indicates whether the ColumnHeaderSection is printable.")>
<EditorBrowsableAttribute()>
<BrowsableAttribute(True)>
Public Overrides Property Printable As Boolean
Dim instance As ColumnHeaderSection
Dim value As Boolean
 
instance.Printable = value
 
value = instance.Printable
[SRCategory("Behavior")]
[Localizable(true)]
[SRDescription("Indicates whether the ColumnHeaderSection is printable.")]
[EditorBrowsable()]
[Browsable(true)]
public override bool Printable {get; set;}

Property Value

true if printable; otherwise, false.
Example
The following code example shows how to make a section that can be printed and one that cannot be printed. For example, you can add two column headers to the template and use one at run time. That section's visible property should be true and the printable property should be false. Another is used for printing, which may have page number information. That section's visible property value should be false and the printable property should be true. This code example is part of a larger example provided for the Section class.
void setPrintableButton_Click(object sender, EventArgs e)
        {
            Template template = Template.Default;

            Section displayHeaderSection = template.ColumnHeaders[0];

            ColumnHeaderSection printHeaderSection = new ColumnHeaderSection();

            printHeaderSection.Height = 40;

            // Initialize and add a PrintInfoCell into printHeaderSection.
            PrintInfoCell printInfoCell = new PrintInfoCell();

            printInfoCell.FormatString = "{PageNumber} of {PageCount}";

            printInfoCell.Size = new Size(template.Width, printHeaderSection.Height);

            printHeaderSection.Cells.Add(printInfoCell);

            template.ColumnHeaders.Add(printHeaderSection);

            // The section used for screen displayn.
            displayHeaderSection.Printable = false;
            displayHeaderSection.Visible = true;

            // The section used to display when printing.
            printHeaderSection.Visible = false;
            printHeaderSection.Printable = true;

            // Reload template
            this.gcMultiRow1.Template = template;
            this.gcMultiRow1.RowCount = 100;

            // Print column header in every page.
            this.gcMultiRow1.PrintSettings.PrintHeader = PrintHeader.AllPages;

            try
            {
                this.gcMultiRow1.PrintPreview();
            }
            catch(Exception ex)
            {
                // Can't find printer.
                MessageBox.Show(ex.Message);
            }
        }
Private Sub setPrintableButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles 
setPrintableButton.Click
        Dim template1 As Template = Template.Default

        Dim displayHeaderSection As Section = template1.ColumnHeaders(0)

        Dim printHeaderSection As New ColumnHeaderSection()

        printHeaderSection.Height = 40

        ' Initialize and add a PrintInfoCell into printHeaderSection.
        Dim printInfoCell As New PrintInfoCell()

        printInfoCell.FormatString = "{PageNumber} of {PageCount}"

        printInfoCell.Size = New Size(template1.Width, printHeaderSection.Height)

        printHeaderSection.Cells.Add(printInfoCell)

        template1.ColumnHeaders.Add(printHeaderSection)

        ' The section uses for screen display.
        displayHeaderSection.Printable = False
        displayHeaderSection.Visible = True

        ' The section used to display when printing.
        printHeaderSection.Visible = False
        printHeaderSection.Printable = True

        ' Reload template
        Me.gcMultiRow1.Template = template1
        Me.gcMultiRow1.RowCount = 100

        ' Print column header in every page.
        Me.gcMultiRow1.PrintSettings.PrintHeader = PrintHeader.AllPages

        Try
            Me.gcMultiRow1.PrintPreview()
        Catch ex As Exception
            ' Can't find printer.
            MessageBox.Show(ex.Message)
        End Try
    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

ColumnHeaderSection Class
ColumnHeaderSection Members

 

 


Copyright © GrapeCity, inc. All rights reserved.