PowerTools MultiRow for Windows Forms 8.0J
PagingMode プロパティ
使用例 

GcMultiRowを印刷するときのページの自動割り当て方法を示す値を取得または設定します。
構文
Public Property PagingMode As PagingMode
public PagingMode PagingMode {get; set;}

プロパティ値

PagingMode値の1つ。既定値はPagingMode.Flowです。
例外
例外解説
System.ComponentModel.InvalidEnumArgumentException指定された値がPagingMode値の1つではありません。
System.ArgumentExceptionAutoFitWidthtrueで、指定された値がPagingMode.MultiColumnsです。
解説

各セクションをページの上から下へ1つずつ印刷する場合は、PagingMode.Flowを使用します。1ページに1つのセクションだけを印刷する場合は、PagingMode.SingleRowを使用します。Templateの幅が狭くて複数のセクションを横に並べて1ページに配置できる場合は、PagingMode.MultiColumnsモードを選択して、各ページにより多くのセクションを印刷できます。

AlignmentPrintHeaderPrintFooterの各設定は、PagingModeによって動作が異なります。

使用例
次のサンプルコードは、PrintStyle.RichスタイルとPagingMode.Flowを使用してGcMultiRowを印刷する方法を示します。このサンプルコードは、GcMultiRow.PrintSettingsに示されている詳細なコード例の一部を抜粋したものです。
void setRichAndFlowButton_Click(object sender, EventArgs e)
{
    Template template1 = CreateTemplate(3, 21);
    AddPrintInfoCellColumnFooterSection(template1, 21);
    this.gcMultiRow1.Template = template1;
    gcMultiRow1.RowCount = 50;

    //The all UI elements will be printed, like UpDown button.
    gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich;
    //The all Rows will be printed from first page to last page one by one.
    gcMultiRow1.PrintSettings.PagingMode = PagingMode.Flow;
    //The GcMultiRow will be aligned by MiddleLeft.
    gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleLeft;
    //Between every two Rows, there will exist 15 pixels space.
    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 will be 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 code above.
        //gcMultiRow1.Print(true);
    }
    catch (Exception ex)
    {
        // Can't find printer driver.
        MessageBox.Show(ex.Message);
    }
    label.Text = "In Rich style, all elements will be printed, like UpDown button; Between two rows, 15 pixels space existed; Only  the 2th to 8th row are printed one by one from page's Top to Bottom; The GcMultiRow will be 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

    'The all UI elements will be printed, like UpDown button.
    gcMultiRow1.PrintSettings.PrintStyle = PrintStyle.Rich
    'The all Rows will be printed from first page to last page one by one.
    gcMultiRow1.PrintSettings.PagingMode = PagingMode.Flow
    'The GcMultiRow will be aligned by MiddleLeft.
    gcMultiRow1.PrintSettings.Alignment = MultiRowContentAlignment.MiddleLeft
    'Between every two Rows, there will exist 15 pixels space.
    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 will be 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 code above.
        '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 will be printed, like UpDown button; Between two rows, 15 pixels space existed; Only  the 2th to 8th row are printed one by one from page's Top to Bottom; The GcMultiRow will be aligned by MiddleLeft; (Click the button again to view the AutoFitWidth property's effect)"
End Sub
参照

PrintSettings クラス
PrintSettings メンバ
Alignment プロパティ
PrintHeader プロパティ
PrintFooter プロパティ
AutoFitWidth プロパティ

 

 


© 2008-2015 GrapeCity inc. All rights reserved.