Type | Description | |||
String | A String expression that specifies the pages being printed. It supports page numbers and/or page ranges separated by commas. For instance: "1,5-7,9-". If empty, all pages are printed. |
The following VB sample adds a button PageRange to the preview's toolbar, with the identifier 200
Print1.ToolBarFormat = Print1.ToolBarFormat + ",|,200"
At this point, the control's Preview displays a 200 button in the right side of the toolbar as shown bellow:
Now update the newly button's caption with "PageRange" caption, and eventually the current page range value using the Refresh event as follows:
Private Sub Print1_Refresh() With Print1 .ItemCaption(200) = "PageRange" If Len(.PageRange) > 0 Then .ItemCaption(200) = .ItemCaption(200) + " " + .PageRange End If End With End Sub
Next, we need to handle the Click event, so once the button is clicked we can select a new selection for pages being printed, using the PageRange property:
Private Sub Print1_Click(ID As Long, SelectedID As Long) If (ID = 200) Then Print1.PageRange = InputBox("Specifies the page range", "PageRange", Print1.PageRange) Print1.Refresh End If End Sub
Using the Refresh event, the PageRange button is updated as soon as you click a page while the CTRL or CTRL+SHIFT combination is pressed.
The following screen shot shows the pages to be printed in white (1,2), while the others being excluded as disabled:
The following screen shot shows the user selection to be printed ( white rectangle ) ( RIGHT click the cursor and moves the cursor to select the area ):
In C# the sample will be like:
private void exprint1_RefreshEvent(object sender) { exontrol.EXPRINTLib.ItemCaptionEnum idPageRange = (exontrol.EXPRINTLib.ItemCaptionEnum)200; exprint1.set_ItemCaption(idPageRange, "PageRange"); if (exprint1.PageRange.Length > 0) exprint1.set_ItemCaption(idPageRange, exprint1.get_ItemCaption(idPageRange) + " " + exprint1.PageRange); } private void exprint1_Click(object sender, int ID, int SelectedID) { if (ID == 200) { exprint1.PageRange = Microsoft.VisualBasic.Interaction.InputBox("Specifies the page range", "PageRange", exprint1.PageRange, 0, 0); exprint1.Refresh(); } }
In VB/NET the sample will be like:
Private Sub Exprint1_RefreshEvent(ByVal sender As System.Object) Handles Exprint1.RefreshEvent With Exprint1 .set_ItemCaption(200, "PageRange") If Len(.PageRange) > 0 Then .set_ItemCaption(200, .get_ItemCaption(200) + " " + .PageRange) End If End With End Sub Private Sub Exprint1_Click(ByVal sender As System.Object, ByVal ID As System.Int32, ByVal SelectedID As System.Int32) Handles Exprint1.Click If (ID = 200) Then With Exprint1 .PageRange = InputBox("Specifies the page range", "PageRange", .PageRange) .Refresh() End With End If End Sub