method ExPrint.Preview ()
Invokes the print preview main frame.

 TypeDescription 

Use the Preview method to invoke the Print Preview Main Frame, that allows you to preview the object being printed on the paper. Use the hWnd property to get the window handle of the Print Preview Main Frame. The Preview method fails if the PrintExt/PrintExts property is not set before. The PageRange property specifies the pages being printed. A page that is not printed shows as disabled. The ToolBarFormat property formats the layout of the preview's toolbar. The control fires the Click event when the user clicks a button in the preview's toolbar. Use the ItemCaption property to specify the caption being displayed in the preview's toolbar. The ItemToolTip property specifies tooltip being displayed when the cursor hovers a button in the preview's toolbar. Use the AutoRelease property on False, to prevent closing the Preview's window when releasing the Print object. The Brings the Preview window on the foreground and activates it. The Foreground property brings the Preview window on the foreground and activates it.

The ExPrint component provides Print and Print Preview features for components like: eXGantt, eXG2antt, eXMLGrid, eXGrid, eXTree, eXList, eXCalendar, eXComboBox, eXPropertiesList, eXEdit, eXFileView, eXOrgChart and so on.

Tip You can copy and paste the page's content to word, excel, mspaint, ...  ( applications that supports OLE Clipboard Mechanism ) by pressing the CTRL + C keys combination in preview mode ( click a page in preview, so it gets selected, and then press CTRL + C, so the clipboard will contain the picture of current page ). 

Tip In preview mode, you can select the pages to be printed, by keeping the CTRL key down while click the page. If the page's background is white, it will be sent to the printer, else it will not.

Tip In preview mode, you can select only a part of the page to be printed, by RIGHT clicking the page and drag the area to be printed. The white part of the page, will be sent to the printer, as soon as you click the Print command ( right click the page where will be the starting point and drag the mouse to define the ending point of the part to be printed

Tip If the ShowMargins property is True, you can click the "One Page" command button in the toolbar, and so the page will show the margins, so the user can resizes the margins of the paper at runtime.

Tip Double clicking the margin of the paper displays the Setup dialog.

Tip CTRL + Double clicking the margin of the page, will make the margin to be the same as the opposite margin.

The following samples show in different programming languages how to provide the print-preview capabilities for eXG2antt control:

Private Sub callPreview()
    With Print1
        Set .PrintExt = G2antt1.Object
        .preview
    End With
End Sub
Private Sub callPreview()
    With Print1
        Set .PrintExt = G2antt1.Object
        .Preview
    End With
End Sub
with thisform.Print1
	.PrintExt = thisform.G2antt1.Object
	.Preview
endwith
Private Sub callPreview()
    With AxPrint1
        .PrintExt = AxG2antt1.GetOcx()
        .Preview()
    End With
End Sub
Private Sub callPreview()
    With Exprint1
        .PrintExt = Exg2antt1
        .Preview()
    End With
End Sub
private void callPreview()
{
    axPrint1.PrintExt = axG2antt1.GetOcx();
    axPrint1.Preview();

}
private void callPreview()
{
    exprint1.PrintExt = exg2antt1;
    exprint1.Preview();
}
void CWindowMFCDlg::callPreview()
{
	m_print.SetPrintExt( m_g2antt.GetControlUnknown() );
	m_print.Preview();
}
void CWindowMFCDlg::callPreview()
{
	m_print.put_PrintExt( m_g2antt.GetControlUnknown() );
	m_print.Preview();
}
void TForm1::callPreview()
{
	Print1->PrintExt = G2antt1->DefaultDispatch;
	Print1->Preview();
}
procedure callPreview(P : TPrint; G : TG2antt);
begin
with P do
begin
 PrintExt := G.DefaultDispatch;
 Preview();
end;
end;
callPreview( Print1, G2antt1 );

The following VB sample implements the IPrintExt interface:

Option Explicit
Implements IPrintExt

Private Sub Command1_Click()
    With Print1
        Set .PrintExt = Me
        .Preview
    End With
End Sub

Private Sub IPrintExt_DrawPage(ByVal Options As Variant, ByVal hDC As Long, ByVal Page As EXPRINTLibCtl.IPage, pbContinue As Boolean)
End Sub

Private Property Get IPrintExt_PageCount(ByVal Options As Variant) As Long
    IPrintExt_PageCount = 1
End Property

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.