MaximumPreviewPages は、印刷操作が実行されるときに作成されるページ数、ひいてはコントロールによって表示できるページ数を制限するために使用されます。
注: 印刷プレビュー操作が完了した後でこのプロパティを変更しても表示されるページ数に影響しませんが、次の印刷操作には影響します (印刷操作が発生する場合)。
Imports Infragistics.Win Imports Infragistics.Win.Printing Imports Infragistics.Win.UltraWinGrid Imports Infragistics.Win.UltraWinScrollBar Imports Infragistics.Win.UltraWinToolbars Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click ' In Me example we want to preview the data in a grid so ' create an instance of a UltraGridPrintDocument. ' Note: This can also be done at design time by adding ' the UltraGridPrintDocument to the form from the toolbox. Dim printDoc As New UltraGridPrintDocument() ' Set the UltraGridPrintDocument's Grid property to a grid ' on the form printDoc.Grid = Me.ultraGrid1 ' Create an instance of a UltraPrintPreviewDialog ' Note: This can also be done at design time by adding ' the UltraPrintPreviewDialog to the form from the toolbox. Dim previewDialog As New UltraPrintPreviewDialog() With previewDialog ' Set its Document property to the UltraGridPrintDocument we created above. ' Note: 'Document' type is System.Drawing.Printing.PrintDocument ' which UltraGridPrintDocument derives from. Therefore, any ' other instance of a PrintDocument will work as well. .Document = printDoc ' automatically generate the preview when the dialog is 1st displayed ' or when the document changes .AutoGeneratePreview = True ' show a status dialog while the preview is being generated .DisplayPreviewStatus = True ' show a status dialog during a print operation that was started ' by the user selecting the 'Print' item on the 'File' menu .DisplayPrintStatus = True ' set the maximum number of preview pages that will be generated. ' If Me is set to zero then no maximum is enforced. .MaximumPreviewPages = 10 ' set the initial mouse action that will be specified when ' the dialog is first displayed. This can be changed by the ' user through a set of tools on the dialog's 'Standard' toolbar .PreviewMouseAction = PreviewMouseAction.DynamicZoom ' Note: the 'PreviewSettings' apply to the prview area while ' the 'ThumbnailSettings' apply to the thumbnail area. .PreviewSettings.ScrollMode = ScrollMode.Immediate .PreviewSettings.ScrollTipStyle = ScrollTipStyle.Show .ThumbnailSettings.PageNumberDisplayStyle = PageNumberDisplayStyle.LeftOfRow .ThumbnailSettings.BorderStyle = UIElementBorderStyle.InsetSoft ' make the status bar at the bottom of the dialog visible .StatusBarVisible = True ' set the overall style of the dialog .Style = ToolbarStyle.VisualStudio2005 ' make the thumbnail area on the left side of the dialog visible. ' Note: Me can be toggled on or off by the user from the 'View' ' menu. .ThumbnailAreaVisible = True ' set the appearance of the current page in the thumbnail area .ThumbnailCurrentPreviewPageAppearance.BackColor = Color.Yellow ' set the appearance of the current page number in the thumbnail area .ThumbnailCurrentPreviewPageNumberAppearance.ForeColor = Color.Red ' set the appearance of the view box in the thumbnail area ' Note: the view box is the displayed in the thumbnail area to identify ' what is currently displayed in the preview area. .ThumbnailViewBoxAppearance.BackColor = Color.Aqua .ThumbnailViewBoxAppearance.BackColorAlpha = Alpha.UseAlphaLevel .ThumbnailViewBoxAppearance.AlphaLevel = 80 ' set the how the view box is displayed in the thumbnail area .ThumbnailViewBoxDisplayStyle = ViewBoxDisplayStyle.AllVisiblePreviewPages ' set the how the view box can be dragged within the thumbnail area .ThumbnailViewBoxDragMode = ViewBoxDragMode.RestrictWithinPage ' use anti-aliasing .UseAntiAlias = True ' Show the dialog modally .ShowDialog(Me) ' dispose the dialog .Dispose() End With End Sub
using Infragistics.Win; using Infragistics.Win.Printing; using Infragistics.Win.UltraWinGrid; using Infragistics.Win.UltraWinScrollBar; using Infragistics.Win.UltraWinToolbars; private void button1_Click(object sender, System.EventArgs e) { // In this example we want to preview the data in a grid so // create an instance of a UltraGridPrintDocument. // Note: This can also be done at design time by adding // the UltraGridPrintDocument to the form from the toolbox. UltraGridPrintDocument printDoc = new UltraGridPrintDocument(); // Set the UltraGridPrintDocument's Grid property to a grid // on the form printDoc.Grid = this.ultraGrid1; // Create an instance of a UltraPrintPreviewDialog // Note: This can also be done at design time by adding // the UltraPrintPreviewDialog to the form from the toolbox. UltraPrintPreviewDialog previewDialog = new UltraPrintPreviewDialog(); // Set its Document property to the UltraGridPrintDocument we created above. // Note: 'Document' type is System.Drawing.Printing.PrintDocument // which UltraGridPrintDocument derives from. Therefore, any // other instance of a PrintDocument will work as well. previewDialog.Document = printDoc; // automatically generate the preview when the dialog is 1st displayed // or when the document changes previewDialog.AutoGeneratePreview = true; // show a status dialog while the preview is being generated previewDialog.DisplayPreviewStatus = true; // show a status dialog during a print operation that was started // by the user selecting the 'Print' item on the 'File' menu previewDialog.DisplayPrintStatus = true; // set the maximum number of preview pages that will be generated. // If this is set to zero then no maximum is enforced. previewDialog.MaximumPreviewPages = 10; // set the initial mouse action that will be specified when // the dialog is first displayed. This can be changed by the // user through a set of tools on the dialog's 'Standard' toolbar previewDialog.PreviewMouseAction = PreviewMouseAction.DynamicZoom; // Note: the 'PreviewSettings' apply to the prview area while // the 'ThumbnailSettings' apply to the thumbnail area. previewDialog.PreviewSettings.ScrollMode = ScrollMode.Immediate; previewDialog.PreviewSettings.ScrollTipStyle = ScrollTipStyle.Show; previewDialog.ThumbnailSettings.PageNumberDisplayStyle = PageNumberDisplayStyle.LeftOfRow; previewDialog.ThumbnailSettings.BorderStyle = UIElementBorderStyle.InsetSoft; // make the status bar at the bottom of the dialog visible previewDialog.StatusBarVisible = true; // set the overall style of the dialog previewDialog.Style = ToolbarStyle.VisualStudio2005; // make the thumbnail area on the left side of the dialog visible. // Note: this can be toggled on or off by the user from the 'View' // menu. previewDialog.ThumbnailAreaVisible = true; // set the appearance of the current page in the thumbnail area previewDialog.ThumbnailCurrentPreviewPageAppearance.BackColor = Color.Yellow; // set the appearance of the current page number in the thumbnail area previewDialog.ThumbnailCurrentPreviewPageNumberAppearance.ForeColor = Color.Red; // set the appearance of the view box in the thumbnail area // Note: the view box is the displayed in the thumbnail area to identify // what is currently displayed in the preview area. previewDialog.ThumbnailViewBoxAppearance.BackColor = Color.Aqua; previewDialog.ThumbnailViewBoxAppearance.BackColorAlpha = Alpha.UseAlphaLevel; previewDialog.ThumbnailViewBoxAppearance.AlphaLevel = 80; // set the how the view box is displayed in the thumbnail area previewDialog.ThumbnailViewBoxDisplayStyle = ViewBoxDisplayStyle.AllVisiblePreviewPages; // set the how the view box can be dragged within the thumbnail area previewDialog.ThumbnailViewBoxDragMode = ViewBoxDragMode.RestrictWithinPage; // use anti-aliasing previewDialog.UseAntiAlias = true; // Show the dialog modally previewDialog.ShowDialog(this); // dispose the dialog previewDialog.Dispose(); }