void setRichAndSingleRowButton_Click(object sender, EventArgs e)
{
Template template1 = CreateTemplate(10, 100);
AddPrintInfoCellColumnFooterSection(template1, 100);
this.gcMultiRow1.Template = template1;
gcMultiRow1.RowCount = 5;
//All elements will be printed.
gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich;
//Only one Row will be printed to one page. You can print ColumnHeader to each page through setting PrintHeader property to AllPages.
gcMultiRow1.PrintSettings.PagingMode = PagingMode.SingleRow;
//The GcMultiRow will be aligned by MiddleCenter.
gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleCenter;
//All Rows will be printed.
gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.AllRows;
//In each page, besides one Row, the ColumnHeader will be printed in the page's head.
gcMultiRow1.PrintSettings.PrintHeader = PrintHeader.AllPages;
//In each page, besides one Row, the ColumnFooter will be 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 part will be printed to new page.
gcMultiRow1.PrintSettings.HorizontalPageBreak = true;
flag = false;
}
else
{
//If Template's width is greater than page's width, the excess part will be 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 code above.
//gcMultiRow1.Print(true);
}
catch (Exception ex)
{
// Can't find printer driver.
MessageBox.Show(ex.Message);
}
label.Text = "The each Row will be printed in each page with the ColumnHeader; The GcMultiRow will be aligned by MiddleCenter; Because the Template's width is greater than page's width, The HorizontalPageBreak will control whether the excess part will be printed to new page.(Click the button again to chang 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 will be printed.
gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich
'Only one Row will be printed to one page. You can print ColumnHeader to each page through setting PrintHeader property to AllPages.
gcMultiRow1.PrintSettings.PagingMode = PagingMode.SingleRow
'The GcMultiRow will be aligned by MiddleCenter.
gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleCenter
'All Rows will be printed.
gcMultiRow1.PrintSettings.PrintRange = MultiRowPrintRange.AllRows
'In each page, besides one Row, the ColumnHeader will be printed in the page's head.
gcMultiRow1.PrintSettings.PrintHeader = PrintHeader.AllPages
'In each page, besides one Row, the ColumnFooter will be 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 part will be printed to new page.
gcMultiRow1.PrintSettings.HorizontalPageBreak = True
flag = False
Else
'If Template's width is greater than page's width, the excess part will be 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 code above.
'gcMultiRow1.Print(true);
gcMultiRow1.PrintPreview()
Catch ex As Exception
' Can't find printer driver.
MessageBox.Show(ex.Message)
End Try
label.Text = "The each Row will be printed in each page with the ColumnHeader; The GcMultiRow will be aligned by MiddleCenter; Because the Template's width is greater than page's width, The HorizontalPageBreak will control whether the excess part will be printed to new page.(Click the button again to chang the HorizontalPageBreak's effect)"
End Sub